Go-templates Questions
Ad
golang template.JS to string and template.HTML to string
I'm using "html/template". how do i convert the value of a template.js object to a string? what about
Passing variable from template.html to views.py by URL (using a file input form)
Maybe this is a very silly question but i'm new using django. i have a certain django template with a set of properties that can be chosen.
How to remove an already selected option from options list to avoid double bookings
I've been scratching my head with this for 2 days hoping for a sudden brainwave and getting nowhere. i've completely drawn a blank with my logic
How to use base_template variable in Django login.html
I have a very simple django 3.1 project that uses the basic login-authentication found in the mozilla tutorial
TemplateDoesNotExist, registration/login.html Django
Am using django authentication model. the problem is when i visit /accounts/login, i get templatedoesnotexist: registration/login.html error
How redirect login.html to chat.html page after successful logged in Django framework?
I have used template/login.html for logging in, after successful logged in how to redirect the login.html page to chatwindow.html page (some other
Broken Jquery Ui style Datepicker
I am trying to use a jquery ui date picker on a datefield in django. but for some reason, it looks very bad. and the input field itself is wired.
Override page.html template from an app
Is it possible to override (or overextend) the page template (pages/page.html) in mezzanine from an app? it seems like the view
Contactform in footer of page
I have a contactform in the footer of a website. so it is on every page. it works, with one problem: as soon as it is sent, it doesn't show
Pagination not taking effect on webpage
I'm applying pagination on my sports.html page. in views.py i'm using listview and using paginate_by = 2 but issue is
Ad
django-component - passing string instead of context variable
Having trouble passing context variable to a django-component view: labels =
how to fix Form validation 'unknow' in django
When i use single form there is no problem but when i used multi-forms in a class based view it's getting validation failed with image field. i
'RelatedManager' object is not subscriptable
Thanks for your time. i'm trying to get the first images of a foreignkey image model and display with the other fields i've read some
Change model object url in django admin list using template overriding
Suppose i have a model of category, and it has been declared in admin.py. there are two things that i want to do using django template
Redirect django url with javascript
I have countdown timer with javascript, i want to redirect to another page after countdown is over.countdown works pefectly but it's not
Django HTML template tag for date
I get date data from an api on the internet, but it comes as a string. how do i convert this to the following format using django html template
How to display contents based on their category on button click in Same page in Django?
I am working on a portfolio project. where i have to categorize the projects based on their categories. i have given buttons for each categories
Why template recognises object as unexpected identifier?
I am trying to populate multiple markers on google maps, using django. from django views.py i am passing listing name and coordinates to the
Django - Variable cached with "with" template tag isn't evaluated
I'm following along this
How to set globally-accessible context variables in django template tags?
There is a template tag which returns a random element from the list. i also need to save all the elements that were in the list and the one that
How can I display the data in the right table by using javascript for-loop and if-satement?
I have some data fetching by ajax, i need to use for-loop and if-statement to check which good belongs to whose shopping cart. and then display in
Ad
How to refresh a div in javascript/jquery
I am facing one issue i am uploading profile picture it saved to s3 bucket and it returns url but i am facing one issue
How to count foreign key objects with annotation in Django?
Hi all! new in django, and confused, help is appreciated! have three models: class
Django 4. Invalid block tag on line 45: 'item.title', expected 'empty' or 'endfor'. Did you forget to register or load this tag?
I work on django 4 i am trying to create a view that will load a template view in django and i am getting the above error. request method:
How to display relationship with back reference at django template through User?
I have such models class employee(models.model): """employee information.""" user =
How to load image under header tag in django?
All other images that are under "img" tag are loading successfully, but i have one image under "header" tag, like this: <header
How to return int from select option value in plain html in django
I have a plain html form which contains a select option, the select option value should return an int to be stored in the database. i have
Javascript in a seperate file not working in Django
I am relatively new to python and django, but have more experience with javascript/jquery. i am now working with django and want to include
Expand the possibility to put offline a post after an event
I'm trying to expand the function that i've showed in
Django: put offline a post after an event
I'm trying to put offline the posts after an event, a definite date. i've developed a simple model for test my aim and inside the model i've put a
Render a list of foreign key in template
Models class head_of_department(models.model): first_name =
Loading a new page without refreshing the current page
Here's my code.... okay.html {% extends "sch/base.html" %} {% load staticfiles %} {% block content %} <div class="row"
Ad
Display all paragraphs of a scraped HTML div in Django
So i have a scraped html div from a news website. which is this piece of html: <div
Uncaught ReferenceError: $ is not defined in console
I am trying to append a div when a checkbox is selected in dajngo template but i keep receiving uncaught referenceerror: $ is not
Django template tag: getting key, value of dictionary
I want to access the key, value of below dictionary and output them into django template file. however, i couldn't get the value. it raised an
Jquery to select a table row on click doesn't work
I'm trying to toggle the class "highlight" of a html table row on click using jquery. the table is created using django template language. the
render_to_string gives error whereas render works
I am trying to render a response back to an ajaz request. the view is reached in the python code, but if i try and render the response to string
how to check if the form doesn't contain any data
I have a form in my template (not django form) my views: def advanced_search(request): publish_houses =
Display a message if loop is empty
I would like to display a message like "no content" using a "if" in my template. i tried : views.py
Trouble using a custom tag correctly with Django
Summary i've been trying to get a custom tag working in django, but seemingly it wont register correctly. the
How to show dynamic drop down in django?
I want to show the bank account number of an employee based on his saved banking details while adding salary. but now i am getting all employee's
Jquery favorite function call api with ajax
I'm trying to create a favorite function in my django template that let user click on the icon and it will call to an api i made to send add and
passing url parameter in django template using form
I'm writing a page that takes an id and finds a user that matches that id. this is the url pattern that i wrote in urls.py:
Ad
Django: Show different content based on User
I'd like to create a school management system for my personal project. let's say there is an admin for every school. but there is some
How to acces the the django ManyToMany Field in django Template
I have set of attributes in my models from which one of the attribute is of type manytomany field. i am able to access all the attributes in
Access a variable from template tag that takes arguments
I have a template tags that takes id on template and returns a list, i want to check the list if the variable is available and make checkbox input
Django - Counting filtered model instances per row in a template table
Let's say i have the following django models: class house(model): author = foreignkey(settings.auth_user_model,
Django extends only one template
I have an app called exercise_tracker and want to extend my base.html with two templates:
JS send html with django tags
I am cretaing widget in js. and i want to send html through jquery.html() method. but i am using also django trans tag. this is my after
How can I only print the the current logged in user data in Django?
From django.db import models from django.contrib import auth from django.urls import reverse from django.contrib.auth.models import user
how to get all data of price, qty from html in js and multiple it accordingly and add it into html in Django. anyone help me
I have attached the html on photo question - how to get all data of price, qty from html in js and multiple it accordingly and add it into html in
adding a url in django-template
I tried to add a url in django template which is supposedly to log out a user <div><a href="{% url
Column hiding using column().visible() in datatable is not working
I have done one application in django. in that application, i want to hide datatable column based on selection of one flag. i have tried
Django; How to organize common functions or similar templates
I'm a beginner. i've been working on django project. now i'm trying to create notification part and i get the count of notifications. the
Ad
How to render datetime.datetime with timezone to the HTML template in Django?
Views.py def myvideo(request, id): myvideo = myvideo.objects.filter(id=id) serializerclassvideo =
display contents of manytomany and foreignjey fields in Django
I'm new to django and i'ma building a basic blog application. i cant show manytomany field (in tags) and a foreignkey field (comments) in my
Django not loading static files
I created added a dashboard to my project it is using bootstrap files which i am trying to load but aren't loading. i am trying to load static
Get data of another child in a template
I'm making a board which can write comments. all functions work well. but the only thing i need is displaying profile of the
How to pass template variable to slice filter in Django templates
I'm trying to slice loop in django template with variable usual way {% for article in
Django test case failing
I am pretty new to django and i ran into a problem. i am not even sure if its a stupid question or not. i want to test if my home view contains
How to show incremented Django model field value in template correctly?
I have a post model and try to achieve properly views counter but this method not work correctly in template when i try to display views counter
Django Admin. How to add background color for each row in list view, when object has boolean field == True?
My env is: django 2.0.6, python 3.6.4 i have standard django admin (with inline edit):
Match string with database in django
A user will come on website and fill the registration form. registration form has a question displayed below which subjects you want to
How to work with nested if else in django templates?
Here, in this project i'm building a ecommerce website and i'm using django. so, here i want to show that if there is no product of category
Running a for loop inside html file for specific time in django
I want a for loop to run 2/3 times for this specific model. lets assume i have 10 data, i want the first 3 one to be shown inside html file
Ad
Error using DjangoFramework in template
New try of dev here. im trying to make a project and i alredy having some issues that i dont know why dont work... i put my code and
How to show in templates if a scheduled end of project is delayed based on end date in django?
I'm kinda stuck with a logic wherein if a project that is past it's due date and it's progress value is still not in 100% completion it should
I am not getting the value from the database
I am using mvt in django. i am using generic cbv (listview, detailview). here are my codes here is model.py
Render returned string in django template
I have been working a lot with django's template language lately, and it works well in most cases, but recently i've come across a small problem
Using Primary Key To Index HTML Template Django
Bit confused on how i would index a list i have based on the primary key in the html template? here is my views page: def
getting the error "The QuerySet value for an exact lookup must be limited to one result using slicing. "
I am trying to create a lms with django. so i have a separate model for the teachers who can upload the courses, and another model for courses.
How to show pics from filcker profile in django template?
I have a filcker profile page with the following url :
Django - Join two table in view and use it in template
I'm using python 3.4.5 with diango 2.0.2 i have 2 tables with a foreign key. for some reasons, i need to use 2 tables to store these
Django : Use multiple CSS file in one html
In django, it is possible to use different css files in one html document ? i would like to use one css for base.html and another one for
Using related_name in Django
I am getting confused with the usage of related_name in django models, i know that the idea is to give me access to all the fields of a different
How to check if request user is in a models class
Lets say you have a class with name car_club and in the class is members, which is a manytomany field to the user. then you want to limit
Ad
AngularJS with Django - Conflicting template tags
I want to use angularjs with django however they both use {{ }} as their template tags. is there an easy way to change one of the
Can not get comment id with AJAX in django
I'm fighting with this problem during several days and can not find the solution for my case. i'm trying to make system of likes without
Trying to save to database via ModelForm Django
My form is not saving to the database or at least i know the form is not valid i just dont know why? because it will always skip to the else in
adding form attribute to inputfield
I am trying to achieve submitting a form with input fields being outside of the form
Delete instance in django ModelForm
I am trying to delete an instance form in django modelform but it's not deleting, the update part is working perfectly though. my
Creating name based user access to certain pages in the nav-bar
I need to create user based access to certain features of my django web-app . i have figured out how to restrict access to users that are
My ModelForm isn't getting auto-populated
In the update template my form isnt getting prepopulated however the functionality of updating is working fine. the form stays empty when i am
module 'website.management.commands.updatemodels' has no attribute 'Command'
I am finding a problem while executing this code on my app 'website' using django
Could not parse the remainder: '${profiles['user']}' from '${profiles['user']}
const data = '{{ search_user }}' const rdata = json.parse(data.replace(/"/g,
Django template - set checkbox checked if object.val == true
I'm junior backend dev. i don't know how to use js. i can't set <input type="checkbox" name="player_check">
How to pass a Javascript variable in django template-tag
Hello i have this question if have a variable <script> var a = true <script> can i use
Ad
Is it okay to have two base.html templates in django?
Is it okay to have multiple base.html templates in django? for instance, i would have one template that would extend from base_one.html and
I have trouble in editing a post in django project
I am working on a django project where i can create a post and also edit a specific post using the post's id. views.py
dictionary values can't be iterated through using their corresponding keys in django template
So i have a nested dictionary in the form of the following: data = { server:{'rating':{'class':'good, 'desc':'whatever'},
Can't pass a variable through my view to the html template
So i'm trying to: pass a variable owner_id in the view def new(request, owner_id) to render new.html that
How do you solve django.db.migrations.exceptions.NodeNotFoundError in Django?
I get the following error when i do python manage.py makemigrations:
how can we query foreign key and get results of objects which are connected to foreign key
How can i can use managers to query my foreign key and then retrieve objects that are connected to foreign key? here is my models.py:
How do you return a complete url with get_success_url(self) in django?
How do you return a url using get_success_url(self) in django without using reverse for a generic view? basically, i want to have
Fetch Django view data with AJAX
Currently i am building an app which update the main page's data via ajax. based on
Validation of reset password link in DJANGO
So i already know that the default time of validation for the password reset link is 3 days, . from -
Django file upload for different apps within a project?
I am working on a project which have various apps like protocol, prediction etc. to perform some calculation "protocol" and "prediction"
Ad
when going to admin giving error site url does not exist
When i am trying to go admin path in the it is giving me error that saying that site matching query does not exist this never happens to me
SEO and Django with title and description tags
I have a base.html for the base template for my files. inside of it, i have tag where i define both title and description tags. i also
Ad
Blog Categories
Ad