API templatetags.uni_form_tags

class templatetags.uni_form_tags.BasicNode(form, helper)[source]

Basic Node object that we can rely on for Node objects in normal template tags. I created this because most of the tags we’ll be using will need both the form object and the helper string. This handles both the form object and parses out the helper string into attributes that templates can easily handle.

get_render(context)[source]

Returns a Context object with all the necesarry stuff for rendering the form

Parameters:
  • contextdjango.template.Context variable holding the context for the node

self.form and self.helper are resolved into real Python objects resolving them from the context. The actual_form can be a form or a formset. If it’s a formset is_formset is set to True. If the helper has a layout we use it, for rendering the form or the formset’s forms.

get_response_dict(attrs, context, is_formset)[source]

Returns a dictionary with all the parameters necessary to render the form/formset in a template.

Parameters:
  • attrs – Dictionary with the helper’s attributes used for rendering the form/formset
  • contextdjango.template.Context for the node
class templatetags.uni_form_tags.UniFormNode(form, helper)[source]
render(context)[source]
templatetags.uni_form_tags.do_uni_form(parser, token)[source]

You need to pass in at least the form object, and can also pass in the optional helper object. Writing the attrs string is rather challenging so use of the objects found in uni_form.helpers is encouraged.

form: The forms object to be rendered by the tag

helper (optional): A uni_form.helpers.FormHelper object.

Usage:

{% include uni_form_tags %}

{% uni_form my-form my_helper %}

Previous topic

API helpers

Next topic

API templatetags.uni_form_filters

This Page