Questions tagged as 'django-templates'

2
answers

Django and Template

Good Night! Guys, I have a problem for 4 days and unfortunately I still can not solve it! I'm working with tamplates in DJango, but I'm having problems because nothing appears on the pages! This is the basic structure of the base.html &...
asked by 28.07.2015 / 02:12
1
answer

Django generating strange code

I'm using visual studio community and I created a web project with Django, but when I make the homepage, it's generating this code: AndthecodeIhaveisthis:{%loadstaticfiles%}<!DOCTYPEhtml><html><head><metacharset="utf-8"...
asked by 06.05.2016 / 04:07
2
answers

How to read and render a .txt file in the Django template?

How do I render the data of a arquivo.txt in a Django template? file content: 1;'one';'foo' 2;'two';'bar' I return in the template    1 - one - foo       2 - two - bar Any tips on where I start? Following the link...
asked by 25.06.2015 / 21:34
1
answer

Django: what's the difference between import / use include () and not use when configuring a URL?

from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^polls/', include('polls.urls')), url(r'^admin/', admin.site.urls), ] In this example I saw that there are two ways to call a URL, one wi...
asked by 30.12.2015 / 16:51
1
answer

Total and subtotal in Django template using predefined lists

How do I calculate the subtotal and the total per column? views.py def soma_tuplas(a, b): return (a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3], a[4]) def quotation_list(request): stores = Store.objects.all() products = Product....
asked by 07.12.2015 / 22:40
1
answer

Returning the minimum value for comparison in template Django

Following up on an answer at link def quotation_list(request): stores = list(Store.objects.all()) products = list(Product.objects.all()) # indice index_store = {store.id: index for index, store in enumerate(stores)} index...
asked by 05.12.2015 / 04:24
1
answer

How do I change the width of the columns in the Admin listing in Django?

How do I specify the width for the columns that are displayed in the Admin listing, more precisely the ones I specify in list_display in admin.py. Searching a similar question here , where I came to the conclusion that I should extend the file...
asked by 19.01.2016 / 15:54
2
answers

Concatenating variables in the Django template

Talk to people, good morning, I have a problem. I'm running a lista but I want concatenar my list that I'm calling in template as {{ list }} and {{ forloop.counter0 }} so that in my is only displayed 1 l...
asked by 05.10.2018 / 17:05
2
answers

Django + Python, modal display using {% if%} in the template

I'm doing a check if there are active classes, if there is not a modal and not the registration form, but it is not working: views.py: from django.shortcuts import render, redirect from django.core.mail import send_mail from django.temp...
asked by 17.09.2018 / 15:03
1
answer

Include in the head tag Djanto Templates

I have the following files: base.html : <!-- base.html -- --> <html> <head> <title>Title</title> {% include "head.html" %} </head> <body> Body </bo...
asked by 04.01.2016 / 14:13