Questions tagged as 'django-templates'

1
answer

Total and subtotal in django template using lists

How do I calculate the subtotal and total per store (store) in the view to play the results in the template? In case I'm using lists. def quotation_list(request): stores = list(Store.objects.all()) products = list(Product.objects.all()...
asked by 06.12.2015 / 07:31
1
answer

Improving the return of a specific result

I think I'm unlearning the basics! I have a result that returns only one element in the dictionary: [{'quant': 236, 'district': 'Centro'}] My context is: context['Districts'] = d As I do in the template I write something like {{ D...
asked by 07.06.2015 / 04:24
1
answer

Django - extend admin template

could someone indicate the best way to extend the django template? and how best to share a template with the admin and site area. I'm using django version 1.8.6 and django-bootstrap3 Thank you.     
asked by 21.11.2015 / 22:12
1
answer

Queryset: Getting the description of the accessories in the application (Django)

Consider the example below: class Vehicle(models.Model): vehicle = models.CharField(_('veículo'), max_length=50, unique=True) price = models.DecimalField(_(u'preço'), max_digits=8, decimal_places=2) kit_fabric = models.ForeignKey(...
asked by 07.06.2015 / 08:48
1
answer

Hide CRUD buttons in Django templates for users who are not logged into the system

I would like to hide the buttons on my system that allow you to: add, edit and delete the data in my templates for users who are not logged into the system. It can be viewed here: link After some queries, I saw that it can be done this way:...
asked by 25.04.2016 / 14:22
1
answer

Python / Django time interval

I need to create a time grid for a calendar: I have the following information in the Django template: Starting time: 08:00 End time: 6:00 p.m. Interval in minutes 00:30 I would like to implement something like: for hora in range...
asked by 06.05.2017 / 18:45
1
answer

Many-to-Many: Django Template and Template

I have the following situation: - Budget - Product - Budget Items I searched for the Many-to-Many relationship in Django (1.10), so create a Template a Multi-Select. But if I need to, for example, inform the quantity of the product in t...
asked by 21.11.2016 / 15:23
2
answers

Doubt when doing a ranking using django!

I'm making a game site using django and I want to do a ranking based on the score of all users! For now it looks like this: views.py : def index(request): perfis = Perfil.objects.all().order_by('-pontuacao_ultima') return render(re...
asked by 09.02.2018 / 00:38
1
answer

How to create a form and authenticate Django user

Good night everyone. I'm developing a project in django just for educational purposes and I could not find a solution to my problem. I could not generate a form for the user to log in, much less authenticate this user. I've already been...
asked by 26.02.2017 / 04:01
1
answer

Django. Only change in bank via html

I've been developing in Django for a short time, I have a nice image on my site, when I click on it I would like to only change a field in the database without reloading or resending the page and stay in the same place. I have a question abo...
asked by 29.08.2018 / 14:40