On 28 tammi, 21:08, Bertrand Bordage <[email protected]>
wrote:
> > I know this answer isn't wanted... But testing different
> > implementations outside Django core/contrib is IMHO the right way to
> > go.
>
> OK, so, discussion closed.
My intention wasn't to stop discussion about this feature, just to say
that it is unlikely to get into Django until there is a proven way to
implement this feature. And by proven I mean there is a 3rd party app
that has enough users.
It might be that there isn't a single approach to this, and in that
case multiple different implementations outside core is the way to go.
If there is something common between most implementations, then core/
contrib is the right place for those shared bits.
Looking at the discussion history maybe finding those shared bits was
all you were trying to do...
So, what I want is:
- To use self of the view collection class to bind data to templates
(that is, one instance per request).
- To use self to call shared functionality between views. That is, I
want to implement both history_view() and the update_view() in the
same class, so that both of them can call shared methods.
If I understand this pattern correctly
class HistoryView(View):
[do something…]
class CustomModelViewSet(ModelViewSet):
excluded_views = ('create_view', 'update_view', 'delete_view')
def __init__(self, *args, **kwargs):
self.views['history_view'] = {
'view': HistoryView,
'pattern': r'history',
'name': 'history',
'kwargs': { custom view attributes and methods here },
}
super(self, CustomViewSet).__init__(*args, **kwargs)
here HistoryView and UpdateView can't share functionality?
I think we are aiming for different use cases, the viewset pattern
seems to be about tying together multiple existing views, while the
MultiViews pattern is about creating the views in a single class.
- Anssi
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.