Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

magic-removal: Changed AutoField.contribute_to_class() to use 'assert…

…' instead of 'if'

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent c7fc2bf commit 5dda10f2ef67f85d7a716141d1b88b5a19cebdd2 @adrianholovaty adrianholovaty committed
Showing with 1 addition and 2 deletions.
  1. +1 −2  django/db/models/fields/
3  django/db/models/fields/
@@ -345,8 +345,7 @@ def get_manipulator_new_data(self, new_data, rel=False):
return Field.get_manipulator_new_data(self, new_data, rel)
def contribute_to_class(self, cls, name):
- if cls._meta.has_auto_field:
- raise AssertionError, "A model can't have more than one AutoField."
+ assert not cls._meta.has_auto_field, "A model can't have more than one AutoField."
super(AutoField, self).contribute_to_class(cls, name)
cls._meta.has_auto_field = True

0 comments on commit 5dda10f

Please sign in to comment.
Something went wrong with that request. Please try again.