AndrewIngram / django-extra-views

Django's class-based generic views are awesome, let's have more of them.
MIT License
1.39k stars 172 forks source link

missing individual form fields rendering #227

Closed nerdoc closed 3 years ago

nerdoc commented 3 years ago

Maybe this is not a bug, but a missing documentation - or maybe a missing possibility in django-extra-views (or my missing ability to find it): in the docs, you use a pattern for inline forms that can be rendered using

<form method="post">
  ...
  {{ form }}

  {% for formset in inlines %}
    {{ formset }}
  {% endfor %}
  ...
  <input type="submit" value="Submit" />
</form>

This is a generic way of rendering forms. But if I ant to customize the inline formsets' rendering layout (let's say a table view of all fields, each field in one column), I can't do that - what am I missing - or can that formset not be used for individual field renderings? When debugging the variable, I see that formsetvariable is of the type the class inheriting from InlineFormSetFactory has. It has a fields (list) attribute, containing all the fields (like CharField, BooleanField etc.) But rendering that fields individually using formset.fields.title }} is not possible, as I supoose these are ModelFields, not FormFields.

Like I said, maybe that's not a bug - then please give me a hint how to render individual fields of InlineFormsets - or - could you implement that if it's not there?

nerdoc commented 3 years ago

Aaargh. After hours of searching and testing, I found it. No Bug, just layer 8 problem, solved.

{{ formset.title }} does work.