encode / django-vanilla-views

Beautifully simple class-based views.
http://django-vanilla-views.org/
BSD 2-Clause "Simplified" License
985 stars 74 forks source link

Additional context in Listview without use super() #23

Closed christianmls closed 10 years ago

christianmls commented 10 years ago

Hi,

How can i aggregate an additional context in Listview for template without use super().

I have this, but I not access to model_list in template def get_context_data(self, **kwargs): kwargs['title'] = 'Products' return kwargs

And with this code works very good def get_context_data(self, kwargs): context = super(ProdutcListView, self).get_context_data(kwargs) context['title'] = 'Products' return context

tomchristie commented 10 years ago

Either (1) just use super, or (2) be explicit, like this:

def get_context_data(self, **kwargs):
    return {
        'view': self,
        'product_list': self.object_list,
        'title': 'Products'
    }