diff options
| author | Ed Henderson <ed@sharpertool.com> | 2016-06-02 12:56:13 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-06-03 11:49:24 -0400 |
| commit | 521772ff0779ced13f94a6ebcd96740a9eafbb1d (patch) | |
| tree | 4acdfd2f0514a599ca50d32dc43f22bb944d8c80 /docs/topics/forms | |
| parent | 971adb9e9ceaf50ecfa72db1b357bb38150048ea (diff) | |
[1.10.x] Fixed #26021 -- Applied hanging indentation to docs.
Backport of 4a4d7f980e2a66756e1e424f7648dcd28ff765b7 from master
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 146b7503d0..df6bd6bd38 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -195,8 +195,10 @@ we'll discuss in a moment.):: class AuthorForm(forms.Form): name = forms.CharField(max_length=100) - title = forms.CharField(max_length=3, - widget=forms.Select(choices=TITLE_CHOICES)) + title = forms.CharField( + max_length=3, + widget=forms.Select(choices=TITLE_CHOICES), + ) birth_date = forms.DateField(required=False) class BookForm(forms.Form): @@ -589,8 +591,12 @@ the field declaratively and setting its ``validators`` parameter:: For example, if the ``Article`` model looks like this:: class Article(models.Model): - headline = models.CharField(max_length=200, null=True, blank=True, - help_text="Use puns liberally") + headline = models.CharField( + max_length=200, + null=True, + blank=True, + help_text='Use puns liberally', + ) content = models.TextField() and you want to do some custom validation for ``headline``, while keeping @@ -598,8 +604,11 @@ the field declaratively and setting its ``validators`` parameter:: ``ArticleForm`` like this:: class ArticleForm(ModelForm): - headline = MyFormField(max_length=200, required=False, - help_text="Use puns liberally") + headline = MyFormField( + max_length=200, + required=False, + help_text='Use puns liberally', + ) class Meta: model = Article @@ -1022,8 +1031,10 @@ formset:: def manage_authors(request): AuthorFormSet = modelformset_factory(Author, fields=('name', 'title')) if request.method == "POST": - formset = AuthorFormSet(request.POST, request.FILES, - queryset=Author.objects.filter(name__startswith='O')) + formset = AuthorFormSet( + request.POST, request.FILES, + queryset=Author.objects.filter(name__startswith='O'), + ) if formset.is_valid(): formset.save() # Do something. |
