Answer the question
In order to leave comments, you need to log in
Django, how to make a report grouped vertically and horizontally, like in Excel - PivotTable?
Hi everybody!
Need to make report template in Django:
views.py
def accessories(request, template_name="accessories.html"):
accessories = Accessories.objects.all().order_by('-created_on')
ctx = {'accessories': accessories}
return render(request, template_name, ctx)
template
{% for accessorie in accessories %}
{{ accessorie.plot }} --> Участок
{{ accessorie.equip }} --> Оборудование
{{ accessorie.work }} --> Работа
{{ accessorie.user }} --> Пользователь
{{ accessorie.created_on|date:"d-m-Y" }} --> Дата
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question