Ticket #10135: 10135.diff

File 10135.diff, 986 bytes (added by Rob Hudson <treborhudson@…>, 7 years ago)

Adding import to documentation in the first case that uses forms

  • docs/ref/forms/fields.txt

    diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
    index 0123380..2f40b6f 100644
    a b how they work. Each ``Field`` instance has a ``clean()`` method, which takes 
    2323a single argument and either raises a ``django.forms.ValidationError``
    2424exception or returns the clean value::
    2525
     26    >>> from django import forms
    2627    >>> f = forms.EmailField()
    2728    >>> f.clean('foo@example.com')
    2829    u'foo@example.com'
  • docs/ref/forms/widgets.txt

    diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
    index c9cc292..9708ca6 100644
    a b built-in Field classes. 
    107107However, if you want to use a different widget for a field, you can -
    108108just use the 'widget' argument on the field definition. For example::
    109109
     110    from djang import forms
     111   
    110112    class CommentForm(forms.Form):
    111113        name = forms.CharField()
    112114        url = forms.URLField()
Back to Top