mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Misc doc cleanups.
This commit is contained in:
parent
c694e6220e
commit
70c080fcdb
@ -52,8 +52,7 @@ widget on the field. In the following example, the
|
|||||||
:attr:`~django.forms.extras.widgets.SelectDateWidget.years` attribute is set
|
:attr:`~django.forms.extras.widgets.SelectDateWidget.years` attribute is set
|
||||||
for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
||||||
|
|
||||||
from django.forms.fields import DateField, ChoiceField, MultipleChoiceField
|
from django import forms
|
||||||
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
|
|
||||||
from django.forms.extras.widgets import SelectDateWidget
|
from django.forms.extras.widgets import SelectDateWidget
|
||||||
|
|
||||||
BIRTH_YEAR_CHOICES = ('1980', '1981', '1982')
|
BIRTH_YEAR_CHOICES = ('1980', '1981', '1982')
|
||||||
@ -62,9 +61,9 @@ for a :class:`~django.forms.extras.widgets.SelectDateWidget`::
|
|||||||
('black', 'Black'))
|
('black', 'Black'))
|
||||||
|
|
||||||
class SimpleForm(forms.Form):
|
class SimpleForm(forms.Form):
|
||||||
birth_year = DateField(widget=SelectDateWidget(years=BIRTH_YEAR_CHOICES))
|
birth_year = forms.DateField(widget=SelectDateWidget(years=BIRTH_YEAR_CHOICES))
|
||||||
favorite_colors = forms.MultipleChoiceField(required=False,
|
favorite_colors = forms.MultipleChoiceField(required=False,
|
||||||
widget=CheckboxSelectMultiple, choices=FAVORITE_COLORS_CHOICES)
|
widget=forms.CheckboxSelectMultiple, choices=FAVORITE_COLORS_CHOICES)
|
||||||
|
|
||||||
See the :ref:`built-in widgets` for more information about which widgets
|
See the :ref:`built-in widgets` for more information about which widgets
|
||||||
are available and which arguments they accept.
|
are available and which arguments they accept.
|
||||||
|
@ -45,7 +45,9 @@ A template contains **variables**, which get replaced with values when the
|
|||||||
template is evaluated, and **tags**, which control the logic of the template.
|
template is evaluated, and **tags**, which control the logic of the template.
|
||||||
|
|
||||||
Below is a minimal template that illustrates a few basics. Each element will be
|
Below is a minimal template that illustrates a few basics. Each element will be
|
||||||
explained later in this document.::
|
explained later in this document.
|
||||||
|
|
||||||
|
.. code-block:: html+django
|
||||||
|
|
||||||
{% extends "base_generic.html" %}
|
{% extends "base_generic.html" %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user