Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

magic-removal: Fixed #1249 -- Fixed bug in manipulator_validator_unique

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2074 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit ee1a1eb5192cd840c60b707e3a1421c33ddc8132 1 parent 32cf0aa
Adrian Holovaty adrianholovaty authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/db/models/fields/__init__.py
2  django/db/models/fields/__init__.py
View
@@ -32,7 +32,7 @@ def manipulator_validator_unique(f, opts, self, field_data, all_data):
old_obj = self.manager.get_object(**{lookup_type: field_data})
except ObjectDoesNotExist:
return
- if hasattr(self, 'original_object') and self.original_object._get_pk_val() == old_obj._get_pk_val():
+ if getattr(self, 'original_object', None) and self.original_object._get_pk_val() == old_obj._get_pk_val():
return
raise validators.ValidationError, _("%(optname)s with this %(fieldname)s already exists.") % {'optname': capfirst(opts.verbose_name), 'fieldname': f.verbose_name}
Please sign in to comment.
Something went wrong with that request. Please try again.