From 5dda10f2ef67f85d7a716141d1b88b5a19cebdd2 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 17 Jan 2006 05:27:02 +0000 Subject: [PATCH] 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 --- django/db/models/fields/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index a2809de0dd..d607c27814 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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