diff options
| author | Julien Phalip <jphalip@gmail.com> | 2011-10-13 11:53:59 +0000 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2011-10-13 11:53:59 +0000 |
| commit | c58e5724bcebc74ccfbc49a4a29de6fd0fa6103e (patch) | |
| tree | 96d2afb17be9acfb3b395d69e72c3d9b6f5754a8 /django | |
| parent | 639400d52fe4c364d91ec67cdb58a3174d33e8ad (diff) | |
Fixed a couple of `assert` syntax warnings mistakingly introduced in r16966 and added some tests to prevent future regressions. Thanks to Anssi Kääriäinen for the report.
Refs #12467.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 7e119c2f86..67acbbae76 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -510,8 +510,8 @@ class AutoField(Field): 'invalid': _(u"'%s' value must be an integer."), } def __init__(self, *args, **kwargs): - assert (kwargs.get('primary_key', False) is True, - "%ss must have primary_key=True." % self.__class__.__name__) + assert kwargs.get('primary_key', False) is True, \ + "%ss must have primary_key=True." % self.__class__.__name__ kwargs['blank'] = True Field.__init__(self, *args, **kwargs) @@ -536,8 +536,8 @@ class AutoField(Field): return int(value) def contribute_to_class(self, cls, name): - assert (not cls._meta.has_auto_field, - "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 cls._meta.auto_field = self |
