Hi Andrew, On Jul 1, 9:12 am, Andrew Ingram <a...@andrewingram.net> wrote: > Hi All, > > I've been working with Django's class-based views a fair bit recently, > specifically to create some additional ones (dealing with formsets > mostly). I've been trying to inherit as much of the existing > functionality as possible, but I've hit a bit of a snag. > > I've a ModelFormSetMixin which extends MultipleObjectMixin, much like > how ModelFormMixin extends SingleObjectMixin in core. > > I want to take advantage of the pagination that MultipleObjectMixin > provides, but I need it at the point of instantiating the FormSet. > Currently MultipleObjectMixin does all the pagination handling in > get_context_data which means I have to either re-implement a lot more > functionality than I'd like, or execute the pagination calculation > twice. > > My ideal solution would be for MultipleObjectMixin to be changed to > have the pagination handled as early as possible so that I can take > advantage of it for free. > > This is only one use case, but I'm sure there are more. I'm happy to > try and come up with a patch if there's some agreement on this. > > The FormSet views I've developed can be seen > here:https://github.com/AndrewIngram/django-extra-views/blob/master/extra_... > > Regards, > Andrew Ingram
I think your proposal makes sense and it's generally a good idea to add more flexibility to class-based views (unless it over-complicates the API, of course). It would definitely help assess the usefulness of this if you posted a patch with a concrete test case, so feel free to open a ticket. You might also be interested in ticket #16256, which is looking at adding similar generic views to core. Perhaps this is something you would like to contribute to based on your own experience and use case? https://code.djangoproject.com/ticket/16256 Regards, Julien -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.