Questions tagged as 'django-generic-views'

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

Difference between get_context_data and get_queryset and code improvement (Django)

I wanted to know the difference between get_context_data and get_queryset. And I'd like to hear from you about my codes. What is right and what is wrong with them? link class SaleDetailView(DetailView): template_name = 'vendas/s...
asked by 18.06.2015 / 04:20
1
answer

Performance in Queryset CBV

# models.py class Book(TimeStampedModel): name = models.CharField(_('nome'), max_length=50) authors = models.ManyToManyField('Author', verbose_name='autores') price = models.DecimalField(_(u'preço'), max_digits=5, decimal_places=2) #...
asked by 22.10.2015 / 04:35
1
answer

How to print page

I want to create a template for printing data but I'm kind of lost in how to do this, I have a print name button, it's in a table that contains the customer's name, phone number, in it it should take the id of this client and the data of the sam...
asked by 10.05.2016 / 00:52