magic-removal: Changed AutoField.contribute_to_class() to use 'assert' instead of 'if'

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-17 05:27:02 +00:00
parent c7fc2bfb68
commit 5dda10f2ef
1 changed files with 1 additions and 2 deletions

View File

@ -345,8 +345,7 @@ class AutoField(Field):
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