django - Using a custom form in a modelformset factory? -


I want to be able to use a customized form in a model format_neteter. For example:

models.py

  class authors (models.model): name = models.CharField () address = models.CharField () class writer (ModelForm) ): Class = meta: model = author  

views.py

  def test_render (request): myModelFormset = modelformset_factory (author) item = author. () FormsetInstance = myModelFormset (queryset = items) Returns render_to_response ('Template', local ())  

The above code works just fine, but note that I am not using AuthorForm Am The question is how can I get modelformset_factory to use AuthorForm (which I am planning to optimize later) rather than creating a default author form?

I think you should be able to pass custom model forms like this:

  myModelFormset = modelformset_factory (author, form = author form)  

Comments