Most voted "django-templates" questions
Use this tag for questions about Django’s template engine, which is intended to separate the presentation of a document from your data.
Learn more…118 questions
Sort by count of
-
0
votes1
answer24
viewsDjango Tinymced
Good Morning guys I am with my program almost ready, at this time I’m trying to integrate DJANGO-TINYMCE to my page plus the tutorials I saw just shows how to use it in Django Adim, my doubt is…
-
0
votes2
answers1736
viewsHow to call a view method in html?
I created the following method in the views.py file: def home(request): name = 'Jacinto' args = {'myName' : name} return render(request, 'accounts/home.html', args) I now want to call this function…
-
0
votes2
answers45
viewsReturning manager in template (Django)
How do I return the amount of books published in the template? I have it # models.py class PublishedManager(models.Manager): def published(self): return self.filter(published=True) class…
-
0
votes1
answer95
viewsChanging the place templates (Django)
I was trying to leave the templates folder (main) out of the 'core' folder because I actually wanted to leave the 'templates' and 'Static' folder out of the 'core' folder'. Check out my project on…
-
0
votes1
answer27
viewsDjango 2 Template missing
In my project I have a project with 2 apps. The first app is learning_logs which has a template, base.html The second app is users, I’m trying to use the learning_logs template on users as follows:…
-
0
votes0
answers38
viewsForm Data Listing - Django
Good night! I have an evaluation form created in Django 2.0.4, in which 3 questions are inserted along with your answers, but when listing the result on a page only the last question and answer is…
-
0
votes1
answer127
viewsbackground-image: url( with a URL that has parentheses with Django template
I have a div as follows: <div style='background-image: url({{ OBJETO.URL }})' class="video-thumb"></div> Where Objeto.url deliver a string like this:…
-
0
votes1
answer697
viewsRender items with Django Forms. Three Models involved, unico Forms
Hello, I’m having doubts to render my model’s items. The system works as follows: User taking an exam Exame. Within each exam has the types of exam ItemExame User generates a report Laudo that pulls…
-
0
votes1
answer66
viewsAccess user data via Django template
I have the user model that I extended from the Django standard class TradingUser(User): avatar = models.ImageField(upload_to='images/', default='images/none.jpg') Only when I try to access this…
-
0
votes0
answers148
viewsException has occurred: Variabledoesnotexist - Django
Hey, guys, I got a mistake I can’t figure out why. I am creating a simple web client registration app with Django, I am using vscode with text editor. When I start the application the error…
-
0
votes3
answers28
viewsShow url name on page
someone knows if da to capture the name of the url on the page? type to want to make a condition to use class="active" example: {% if url 'create_indicador' %} <li class="active">....... {%…
-
0
votes0
answers436
viewsConvert HTML to PDF and insert Image with Django
The image does not appear in PDF, I use xhtml2pdf. reports/sol_access.html <img src="{% static 'img/small_logo.png' %}" alt="Blue Tech" style="max-width:200px; margin-top:10px"> view py. ` def…
-
0
votes1
answer39
viewsHow to calculate the frequency the data appears on Django?
Hi, I’m making a search bar with filters, in it the user can choose whether to sort by frequency or sort by another field (which is ordering everything right), what gives problem is when searching…
-
0
votes1
answer793
viewsNoreversematch error in Django
Hello! Studying on Django and developing in this framework, I came across the following error: Noreversematch at / Reverse for 'displayURL' with Arguments '('',)' not found. 1 Pattern(s) tried:…
python python-3.x web-application django django-templatesasked 6 years, 9 months ago Thiago Benine 95 -
0
votes0
answers9
views{{user}} shows Anonymoususer even with the user logged in djangocms
I have a plugin that shows some information, among it the logged in user. But every time I try to show {{request.user}} or {{user}} Emplete always rederizes as Anonymoususer. I thank you from the…
-
0
votes1
answer46
viewsJquery, sum up table
I am not managing to generate a general total of my table, in each row I have the quantity and price. I need to generate the total value. The current logic is reading all the rows of the table and…
-
0
votes1
answer320
viewsTotal values in Django template
I’m developing a forum that on the index page I need to show the subject, how many topics has this subject and how many posts, I can even get back number of topics, but only shows the topic with the…
-
0
votes1
answer11
viewsContext variable Processors does not work with render_to_string
In some places on my system, I rescan a page with render_to_string, because I want to render only a small content. In these cases I do not receive my variables that I created in context_processors.…
-
0
votes1
answer1126
viewsDjango datetimefield as text
I am creating an application on Jango where I will have a form to create scheduling queries, my model is like this: class Agenda(models.Model): """Criação da agenda de consultas da Clinica"""…
-
0
votes1
answer49
viewsI can’t access a url, either fully or by Slug
I’m taking a Django course that uses as a study a simplemooc platform, but I stopped in a class where when trying to access the course details that is in a separate url in a dynamic list, there is…
-
0
votes1
answer42
viewsShow list items filtering by date.Today()
I have a list that I order by position in my models.py, but I have the field start_date I want to use as a validator so that the item is visible or not. But it is not working: py views.: from…
-
0
votes1
answer588
viewsJavascript variable in Django template
Hello guys, good afternoon, I need to use a JS variable, being it the type Boolean in the Django template but I don’t know how to do it. Example of what I want to do: <!DOCTYPE html>…
-
0
votes2
answers77
viewsELIF using not in, inside a FOR
I would like to know if there is any way to refine the ELIF within a FOR, so that it does not enter into it whenever the date does not exist, but if that date specifies it does not exist. Follow the…
-
0
votes1
answer351
viewsHow to Put Value in the Django Will HTML Field?
Hello, I’m starting with Django now and wanted to know how to pass the value of the database to a Djando field using HTML to save the edit. Na minha View: @login_required def editar_aluno(request,…
-
0
votes1
answer445
viewsCommunicate template with view
I have a Django project where I ask the user to enter two dates (initial and final), and through them I make a query in an external database, making an input works, but wanted to take this…
-
0
votes2
answers883
viewsDecimal places in Django template
Good morning, everyone, I’m having a basic problem but apparently boring to solve: {% load l10n %} {% localize off %} var dados_grafico = [ [ 'Entradas',…
-
0
votes2
answers452
viewsHow to get a template that’s in another app on Django
Hey, guys, you okay? So people are starting now to program in Django I’m really enjoying, only a question arose, I wonder if you have how to leave the template html base. as "Universal" what I mean…
-
0
votes1
answer183
viewsHow to create a view with more than one form in Django
I have model, form and template for units, and in this same template I need to add a region form (these are exams). How can I add this form in the view so it can be edited in the drive template? py…
-
0
votes1
answer78
viewsI can’t display a comment list for a post in the Django template
I have a method called get_comments in the models that returns the comments of my post, but when I display in the template, only the posts are displayed, the Comments are not. Django does not return…
-
0
votes1
answer59
viewsGenerate a context from another instance in Createview
Hello! I need to render a context in the Createview template. no requeste to passing an id, and I want to put the name of that id in the Createview template py.url urlpatterns = […
-
0
votes1
answer105
viewsI’m having trouble showing my Manytomany field models on the Django template
I wonder how I can show my Manytomany field on my table, follow the code below. My Model: class Instrutor(models.Model): id = models.AutoField(primary_key=True) registro_instrutor =…
-
0
votes1
answer63
viewsDjango, special characters for HTML with content saved in the database
Good morning, I have contents saved in HTML database: Field: content <p><img src="/media/django-summernote/2019-08-26/2ed93bb9-8293-4b98-9ccb-eeba931421b5.png" style="width: 255px; float:…
-
0
votes1
answer78
viewsI cannot get the correct item id as parameter
I have an app django of posts (posts) and comments from posts. In it I can also delete one post, however while deleting a post the application only deletes the post with higher id. The same occurs…
-
0
votes2
answers483
viewsaccess field value within Django template
You can access the values within a variable in Django templates? For example, I have this model: class Avaliacao(models.Model): post = models.TextField() data_inclusao = models.DataField() in the…
-
0
votes0
answers34
viewsHow do I have my application already implemented in Heroku present the filefield of Django?
In my localhost my app works fine, but when I do deploy in the heroku it does not show uploads of my. pdf files MODEL.PY from django.db import models from django.contrib.auth.models import User #…
-
0
votes1
answer90
viewsTernary condition in Django Templates
I wish I could do that: {% if is_premium > 0 %} <span class="text-success d-block">Você é Premium e possui {{ is_premium }} {{ ' dias' if is_premium > 1 else ' dia' }}</span> {%…
-
0
votes1
answer658
viewsRender JSON data received from an API in an HTML/Django Table
Friends, I need your help! I am new to Python/Django and I am doing this project with the knowledge that I acquire in day-to-day studying. I have a function in my views.py that communicates with an…
-
0
votes1
answer98
viewsDjango n:n relationship with grid call
Good night. I am creating a system in Python/Django where I have a relationship n:n between a table Person and another Process and for this I created a third entity called Procedural part. I’ve done…
-
0
votes1
answer662
views'Nonetype' Object has no attribute 'groups'
I’m using a function in mine Templatetagsdjango that basically checks if the user is in the group that has the permission for the given button. The return 'True or False' works well, IE, it shows…
-
0
votes1
answer207
viewsNoreversematch at /view_clients/
I want to print out a simple customer sheet inside a list of customers I’ve registered in the app. When I click on the link to generate me returns this error: Noreversematch at /view_clients/…
-
0
votes1
answer446
viewsImages disappear in Heroku after a while
I made a website for a newspaper in Django. I have deployed to Heroku and there I have a news register, where I have the title, summary, content and date fields. According to the model: class…
python django web-application heroku django-templatesasked 4 years, 5 months ago Gustavo Augusto Pires 13 -
0
votes1
answer207
viewsHow to use the Django admin template non my form
I’m learning about Django’s admin site and my question is: I have a modelForm and one of the fields is a foreignKey and would like the change, Edit and delete options as in the Django template (that…
-
0
votes1
answer31
viewsHow to show the path of Filefields linked to a specific object in the template?
Good afternoon! I have a web application being made in Django, and I don’t know how to show in the template the path of all Filefields that are linked to an object. I own two models. One for a…
-
0
votes1
answer228
viewsPage not found(404) - polls views Django tutorial
I’m doing the Django documentation tutorial in part 3 (https://docs.djangoproject.com/en/3.1/intro/tutorial03/) where it is said after adding some codes the following: "Take a look in your browser,…
-
0
votes1
answer200
viewsDjango Error 3.1.3 Reverse for 'post_detail' not found. 'post_detail' is not a Valid view Function or Pattern name
Python 3.8.3 Django 3.1.3 I don’t understand why this mistake is happening. Reverse for 'post_detail' not found. 'post_detail' is not a Valid view Function or Pattern name. The line the error…
-
0
votes2
answers157
viewsDjango: Css not imported
I am developing my first site with Django and I came across a problem: While running the browser application, as changes contained in the css file do not apply to the website when I try to import…
-
0
votes1
answer43
viewsHow to call a function by loading a string in Django?
I’m new to Django and I’m testing, In case I have my.html posts and wanted to load all posts summarized on the page, but one side would load the posts with id pair and the other side with id odd. I…
-
0
votes1
answer33
viewsFormat timedelta in Django template
I’m having trouble presenting the uptime time of an equipment, Django automatically shows in the following format: I would like to present this time value in Portuguese. in the settings.py Timezone…
-
0
votes0
answers19
viewsCustomizing the Django Admin Change Log
all right? I am setting up a system to register accesses and users and need to improve the log list of Admin, so that it presents more information as the value changed and not only which fields were…
-
0
votes0
answers62
viewsList users contained in the Django group
I followed the explanations of a page to create a group and add users to the group. But now I want to list the users contained in the group and show in html html tried some variations but no return…