Dnia 2011-07-15, pią o godzinie 16:07 +0530, Kenneth Gonsalves pisze: > caveat - I have never used generic views, class based or otherwise, > but > I was under the impression that if one wants customised forms or > views, > generic is not the way to go.
Why not? The model edit views use the ModelFormMixin, which has a get_form_class that can be overriden [1] to taste. You can simply get the form from super().get_form_class and put it through modelform_factory [2] again to only get the form for the fields you want. The classy generic views are really flexible like that. Sadly docs aren't that great, so reading the code is probably best to get the hang of it. [1] https://code.djangoproject.com/browser/django/trunk/django/views/generic/edit.py#L66 [2] https://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L370 Cheers -- Michał (Saviq) Sawicz <mic...@sawicz.net>
signature.asc
Description: This is a digitally signed message part