Ticket #8788: 8788-2.diff

File 8788-2.diff, 2.3 KB (added by Michael Radziej, 16 years ago)
  • django/forms/models.py

    diff --git a/django/forms/models.py b/django/forms/models.py
    index 56e7f2a..633b26c 100644
    a b class BaseModelForm(BaseForm):  
    220220            except FieldDoesNotExist:
    221221                # This is an extra field that's not on the ModelForm, ignore it
    222222                continue
    223             # MySQL can't handle ... WHERE pk IS NULL, so make sure we don't
     223            # MySQL can't handle ... WHERE pk IS NULL, so make sure we
    224224            # don't generate queries of that form.
    225225            is_null_pk = f.primary_key and self.cleaned_data[name] is None
    226226            if name in self.cleaned_data and f.unique and not is_null_pk:
    class BaseModelForm(BaseForm):  
    244244            if self.instance.pk is not None:
    245245                qs = qs.exclude(pk=self.instance.pk)
    246246               
    247             # This cute trick with extra/values is the most efficiant way to
     247            # This cute trick with extra/values is the most efficient way to
    248248            # tell if a particular query returns any results.
    249249            if qs.extra(select={'a': 1}).values('a').order_by():
    250250                model_name = capfirst(self.instance._meta.verbose_name)
  • docs/topics/forms/modelforms.txt

    diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
    index 80857ae..a56558a 100644
    a b parameter when declaring the form field::  
    337337Overriding the clean() method
    338338-----------------------------
    339339
    340 You can overide the ``clean()`` method on a model form to provide additional
    341 validation in the same way you can on a normal form.  However, by default the
     340You can override the ``clean()`` method on a model form to provide additional
     341validation in the same way you can on a normal form. However, by default the
    342342``clean()`` method validates the uniqueness of fields that are marked as unique
    343 on the model, and those marked as unque_together, if you would like to overide
    344 the ``clean()`` method and maintain the default validation you must call the
     343or unique_together on the model. Therefore, if you would like to override
     344the ``clean()`` method and maintain the default validation, you must call the
    345345parent class's ``clean()`` method.
    346346
    347347Form inheritance
Back to Top