Changes between Initial Version and Version 1 of Ticket #21753, comment 4


Ignore:
Timestamp:
Jan 9, 2014, 4:10:58 AM (10 years ago)
Author:
Marc Tamlyn

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21753, comment 4

    initial v1  
    22Generally fatter forms and thinner views are recommended. The above use-case should be solved by subclassing ModelForm and adapting the fields, then use the new ModelForm in the View.
    33
    4 Dynamic form creation dependent of request data can be done by passing data to Form.__init__() and adapting the fields there. Alternatively one can change the form_class in get_form_class by doing something like: return SuperForm if self.request.user.is_superuser else NormalForm.
     4Dynamic form creation dependent of request data can be done by passing data to `Form.__init__()` and adapting the fields there. Alternatively one can change the form_class in get_form_class by doing something like: return SuperForm if self.request.user.is_superuser else NormalForm.
    55
    66It should be noted in the docs that `fields` was added to View from a security point of view, not for customization of forms.
Back to Top