{% extends "base.html" %} {% load examples_tags %} {% block title %}Rendering Individual Fieldsets{% endblock %} {% block content %}
Like normal forms, you don't need to render fieldset-enabled forms all at once. If you need to render fieldsets individually you can access them one by one and call rendering functions as_table
, as_ul
and as_p
on them.
You can iterate over fieldsets with iter_fieldsets
or use dictionary access with fieldset_dict
. Keys for the dictionary fieldset_dict
returns will be slugified fieldset titles. Slugify function is the same as Django default template filter slugify
, except space characters will be replaced with underscores instead of hyphens.
WARNING: when rendering fieldsets individually errors raised from hidden fields will render within the fieldset. But you still need to call non_field_errors
somewhere in your template to get the top level errors. It is up to you to format and display these. This is just when you render fieldsets individually, as_fieldset_table
, as_fieldset_ul
and as_fieldset_p
takes care of top level errors.