Code

Ticket #8788: 8788-2.diff

File 8788-2.diff, 2.3 KB (added by mir, 6 years ago)
Line 
1diff --git a/django/forms/models.py b/django/forms/models.py
2index 56e7f2a..633b26c 100644
3--- a/django/forms/models.py
4+++ b/django/forms/models.py
5@@ -220,7 +220,7 @@ class BaseModelForm(BaseForm):
6             except FieldDoesNotExist:
7                 # This is an extra field that's not on the ModelForm, ignore it
8                 continue
9-            # MySQL can't handle ... WHERE pk IS NULL, so make sure we don't
10+            # MySQL can't handle ... WHERE pk IS NULL, so make sure we
11             # don't generate queries of that form.
12             is_null_pk = f.primary_key and self.cleaned_data[name] is None
13             if name in self.cleaned_data and f.unique and not is_null_pk:
14@@ -244,7 +244,7 @@ class BaseModelForm(BaseForm):
15             if self.instance.pk is not None:
16                 qs = qs.exclude(pk=self.instance.pk)
17                 
18-            # This cute trick with extra/values is the most efficiant way to
19+            # This cute trick with extra/values is the most efficient way to
20             # tell if a particular query returns any results.
21             if qs.extra(select={'a': 1}).values('a').order_by():
22                 model_name = capfirst(self.instance._meta.verbose_name)
23diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
24index 80857ae..a56558a 100644
25--- a/docs/topics/forms/modelforms.txt
26+++ b/docs/topics/forms/modelforms.txt
27@@ -337,11 +337,11 @@ parameter when declaring the form field::
28 Overriding the clean() method
29 -----------------------------
30 
31-You can overide the ``clean()`` method on a model form to provide additional
32-validation in the same way you can on a normal form.  However, by default the
33+You can override the ``clean()`` method on a model form to provide additional
34+validation in the same way you can on a normal form. However, by default the
35 ``clean()`` method validates the uniqueness of fields that are marked as unique
36-on the model, and those marked as unque_together, if you would like to overide
37-the ``clean()`` method and maintain the default validation you must call the
38+or unique_together on the model. Therefore, if you would like to override
39+the ``clean()`` method and maintain the default validation, you must call the
40 parent class's ``clean()`` method.
41 
42 Form inheritance