{% extends "admin/base_site.html" %} {% load i18n %}{% load url from future %} {% block bodyclass %}grp-doc{% endblock %} {% block content-class %}{% endblock %} {% block title %}Grappelli Documentation » Form Fields{% endblock %} {% block extrahead %} {% endblock %} {% block breadcrumbs %} {% endblock %} {% block content %}

Form Fields

Of course you may use all common type of form fields with Grappelli.
There are some classes and specific types of form fields which are explained below.

Labels

To mark a label as required simply add the class .required.
Labels are outside Grappellis namespace because they come from the depth of Django.

Module

{% filter force_escape %}

Module

{% endfilter %}

Form Field Widths

The following classes basically handle the widths of form fields in different contexts.

They apply only to form fields which are not children of any grid-container (e.g. .g-d-c or .g-d-24).
Form fields which are children of a grid-container always stretch to 100% width.
For more detailled informations about the grid Grappelli uses take a look at the grid system we use.

Text & Numbers

.vTextField

.vLargeTextField

.vPositiveSmallIntegerField

Filebrowse, URL, XML

.vFileBrowseField

.vURLField

.vXMLLargeTextField

Date & Time

.vDateField

.vTimeField

Many to Many & Foreign Keys

.vManyToManyRawIdAdminField

.vForeignKeyRawIdAdminField

Read-Only Fields

Form fields which can be read only are represented as div.grp-readonly.

Module

Read-only form field
{% filter force_escape %}

Module

Read-only form field
{% endfilter %}

Errors in Forms

Please take a look at errors in forms.

{% endblock %}