Questions tagged as 'django-templates'

1
answer

What is the correct way to do the template in Django / python?

This has been my first contact with the framework and with mvc / mvt, and I am in doubt, in terms of good practices and tals, should I make a template for each of the views or should I just make a template and change the template content dynamic...
asked by 16.03.2018 / 18:14
1
answer

How to use objects.filter in django?

Good afternoon, I have a model here in my django Subject, and I want to make the listing of it in the html, however every subject has as foreign key the id of the model category, as I make a variable to receive the objects.filter only of the sub...
asked by 24.11.2017 / 15:46
1
answer

Exchanging template_name in TemplateView (Django)

How do I change the template_name in TemplateView if the user is authenticated? Look what I've tried class Home(TemplateView): # template_name = 'index.html' is_auth = False def get(self, request): if not request.user....
asked by 03.04.2016 / 07:03
1
answer

"NoReverseMatch at /" in Django, when I try to put a link on the [closed]

When I try to put a link on a button, a page with NoReverseMatch at/ error appears, I do not know what to do, I want to put this link to go to app of user registry that is called login . <button href="{% url "login.views.r...
asked by 10.08.2015 / 02:12
1
answer

Django + Python how to update a table item

Speak people, I have a registration flow where in a first step except the student and then the data of the responsible, but after that I need the student to make a description and that description has to be inserted in the respective student, ho...
asked by 17.08.2018 / 15:18
1
answer

Returning more than one Django data list

I made a homepage using django, I'm loading my slides and menus dynamically and it was perfect. I put both the menu and the footer through include and it worked 100%. Now I came across a problem, the product menu loaded on the main page when...
asked by 11.06.2018 / 04:40
0
answers

Pandas DataFrame to_html or iterate over the data in the template?

I actually wanted to iterate over the data in the template? But how do I play my pivot data in context and treat them in the template? df = pd.DataFrame(data) pv = df.pivot(index='cands', columns='titles', values='grades') context['quizzes'...
asked by 04.10.2017 / 03:09
1
answer

How to copy record with DetailView and get in pk (Django)

Consider my template: entry_detail.html <form class="navbar-form navbar-right" action="." method="get"> <!-- add --> <!-- <p name="filter_link" class="pull-right"><a href="">Produtos em baixo estoque</a...
asked by 11.07.2015 / 08:35
1
answer

background-image: url (with a URL that has parentheses with Django template

I have a div like this: <div style='background-image: url({{ OBJETO.URL }})' class="video-thumb"></div> Where Objeto.url delivers a string like this: http://dominio/rota/id/original/(nome)8.jpg When rendering the HTM...
asked by 11.12.2016 / 19:48
1
answer

Show list items by filtering by date.today ()

I have a list that I sort by position in my models.py , however I have the start_date field that I want to use as a validator for the item to be visible or not. But it is not working: views.py : from django.shortcuts...
asked by 27.09.2018 / 20:32