Skip to content

Commit

Permalink
magic-removal: Changed AutoField.contribute_to_class() to use 'assert…
Browse files Browse the repository at this point in the history
…' instead of 'if'

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2027 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jan 17, 2006
1 parent c7fc2bf commit 5dda10f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions django/db/models/fields/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ def get_manipulator_new_data(self, new_data, rel=False):
return Field.get_manipulator_new_data(self, new_data, rel) return Field.get_manipulator_new_data(self, new_data, rel)


def contribute_to_class(self, cls, name): def contribute_to_class(self, cls, name):
if cls._meta.has_auto_field: assert not cls._meta.has_auto_field, "A model can't have more than one AutoField."
raise AssertionError, "A model can't have more than one AutoField."
super(AutoField, self).contribute_to_class(cls, name) super(AutoField, self).contribute_to_class(cls, name)
cls._meta.has_auto_field = True cls._meta.has_auto_field = True


Expand Down

0 comments on commit 5dda10f

Please sign in to comment.