~ubuntuone-hackers/django-formfieldset/trunk

« back to all changes in this revision

Viewing changes to example/templates/examples/individual.html

  • Committer: Atamert Ölçgen
  • Date: 2010-01-02 20:08:58 UTC
  • Revision ID: git-v1:ede0a44b9f954cbb375c816552abc89cae82e745
individual fieldset rendering example

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{% extends "base.html" %}
 
2
{% load examples_tags %}
 
3
 
 
4
 
 
5
{% block title %}Rendering Individual Fieldsets{% endblock %}
 
6
 
 
7
 
 
8
{% block content %}
 
9
  <h3>Rendering Individual Fieldsets</h3>
 
10
  <p>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 <code>as_table</code>, <code>as_ul</code> and <code>as_p</code> on them.</p>
 
11
 
 
12
  <p>You can iterate over fieldsets with <code>iter_fieldsets</code> or use dictionary access with <code>fieldset_dict</code>. Keys for the dictionary <code>fieldset_dict</code> returns will be slugified fieldset titles. Slugify function is the same as Django default template filter <code><a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#slugify">slugify</a></code>, <strong>except space characters will be replaced with underscores instead of hyphens</strong>.</p>
 
13
 
 
14
  {% example "individual" %}
 
15
 
 
16
  <p><strong>WARNING:</strong> when rendering fieldsets individually errors raised from hidden fields <strong>will</strong> render within the fieldset. But you still need to call <code>non_field_errors</code> 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, <code>as_fieldset_table</code>, <code>as_fieldset_ul</code> and <code>as_fieldset_p</code> takes care of top level errors.</p>
 
17
{% endblock content %}