{% extends "docs.html" %} {% block docs_fragment %}
forms application for django: avoids the use of class statements which uses metaclasses for the declaration of form properties and other things (validation and widgets).
each field of the forms is declared like these:

field(label="", n="serv_form", type=ft("string"))

argument n="serv_form" is the name of the form. needed for ordering of the fields. it is necessary and must match the name of the form.

argument type=ft("string") to specify the type of the field(not really just to group related properties together). use of string not python names to make it variable and possibly configurable. if not specified it defaults to ft("string"). arguments to the field type might be passed like these:  type=ft("string")(maxlen=50,minlen=None)

a sample form declaration:
serv_form = {
  pnum = field(label="Port Number", n="serv_form", type=ft("int"),
  sname = field(label="Service Name", n="serv_form",
      type=ft("string")(maxlen=50,minlen=None),
}

the form declaration above describes the fields of the forms. the creation of the form is done using former from the forms module
  serv_form = former(serv_form, {n='serv_form', })

if the form have been totally created (i.e. after a call to former and the object referred to as form is the return value of the function), addition of fields can be done by using for function add_field.:
  add_field(serv_form, {"addr_range": field(label="Address Range",
        n="serv_form",)})

for defaults, pass a deffunc argument to the former.:
  serv_form = former(serv_form, {n='serv_form'}, deffunc=c)

c is a callabled object e.g any function

{% endblock %}