Ticket #14152: model_fullclean.diff

File model_fullclean.diff, 865 bytes (added by ludovicofischer, 14 years ago)

Model.full_clean() changes

  • django/db/models/base.py

    diff --git a/django/db/models/base.py b/django/db/models/base.py
    index 1927b1e..13f353b 100644
    a b class Model(object):  
    856856        if exclude is None:
    857857            exclude = []
    858858
     859        # We need to run clean() first, to make sure any custom field
     860        # settings are applied before using clean_fields
    859861        try:
    860             self.clean_fields(exclude=exclude)
     862            self.clean()
    861863        except ValidationError, e:
    862864            errors = e.update_error_dict(errors)
    863865
    864         # Form.clean() is run even if other validation fails, so do the
    865         # same with Model.clean() for consistency.
     866
    866867        try:
    867             self.clean()
     868            self.clean_fields(exclude=exclude)
    868869        except ValidationError, e:
    869870            errors = e.update_error_dict(errors)
    870871
Back to Top