Hello Kevin,
Generic Views are much more powerful than simple shortcut functions. With a
generic view, you can easily display a queryset, or details about a queryset
item without writing much code. Shortcut functions only make the _call_ to
rendering easier and lack the ability to "automagically"
Hi Andre,
Well, it would be much easier if get_context_data only needs to return a
dictionary. Guess I'll build my own class for that :)
But apart from that, my real question is why there are generic views *and*
shortcut functions. Which is recommended in which case?
Cheers,
Kevin
--
You
The rationale behind class-based views is that they are meant to be reused.
While all of the listed approaches work, CBVs have greater functionality and
modularity. It might seem like more code at first, but the possibility of
using Mixins and overriding just bits and pieces of other views you
Hi,
I am wondering why Django 1.3 has both class-based generic views (like
TemplateView and RedirectView) and shortcuts like django.shortcut.render and
django.shortcut.redirect. What is the recommended way to write your views?
Is a call to render() from within your own view function better
4 matches
Mail list logo