Ticket #6690: modelforms.patch

File modelforms.patch, 721 bytes (added by jdetaeye, 7 years ago)

modelforms documentation update

  • docs/modelforms.txt

     
    358358
    359359Chances are these notes won't affect you unless you're trying to do something
    360360tricky with subclassing.
     361
     362Dynamically creating ModelForms
     363-------------------------------
     364
     365In some cased the model or the fields aren't known in advance.
     366Using Python's dynamic class creation such cases can easily be handled.
     367
     368    >>> # Dynamically create a ModelForm subclass
     369    ... MyMeta = type("MyMeta", (), {'model': MyModel, 'fields': ('field1', 'field2')})
     370    ... MyForm = type("MyForm", (ModelForm,), {"Meta": MyMeta})
Back to Top