Author: Alex Date: 2010-06-30 20:53:05 -0500 (Wed, 30 Jun 2010) New Revision: 13408
Modified: django/branches/soc2010/query-refactor/django/db/backends/__init__.py django/branches/soc2010/query-refactor/django/db/backends/postgresql/operations.py django/branches/soc2010/query-refactor/django/db/models/base.py Log: [soc2010/query-refactor] Fixed a number of issues under postgresql. Modified: django/branches/soc2010/query-refactor/django/db/backends/__init__.py =================================================================== --- django/branches/soc2010/query-refactor/django/db/backends/__init__.py 2010-07-01 01:45:44 UTC (rev 13407) +++ django/branches/soc2010/query-refactor/django/db/backends/__init__.py 2010-07-01 01:53:05 UTC (rev 13408) @@ -560,7 +560,7 @@ if not router.allow_syncdb(self.connection.alias, model): continue for f in model._meta.local_fields: - if isinstance(f, models.AutoField): + if isinstance(f, models.BaseAutoField): sequence_list.append({'table': model._meta.db_table, 'column': f.column}) break # Only one AutoField is allowed per model, so don't bother continuing. Modified: django/branches/soc2010/query-refactor/django/db/backends/postgresql/operations.py =================================================================== --- django/branches/soc2010/query-refactor/django/db/backends/postgresql/operations.py 2010-07-01 01:45:44 UTC (rev 13407) +++ django/branches/soc2010/query-refactor/django/db/backends/postgresql/operations.py 2010-07-01 01:53:05 UTC (rev 13408) @@ -6,10 +6,9 @@ # used by both the 'postgresql' and 'postgresql_psycopg2' backends. class DatabaseOperations(BaseDatabaseOperations): - def __init__(self, connection): - super(DatabaseOperations, self).__init__() + def __init__(self, *args, **kwargs): + super(DatabaseOperations, self).__init__(*args, **kwargs) self._postgres_version = None - self.connection = connection def _get_postgres_version(self): if self._postgres_version is None: @@ -117,7 +116,7 @@ # and column name (available since PostgreSQL 8) for f in model._meta.local_fields: - if isinstance(f, models.AutoField): + if isinstance(f, models.BaseAutoField): output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" % \ (style.SQL_KEYWORD('SELECT'), style.SQL_TABLE(model._meta.db_table), Modified: django/branches/soc2010/query-refactor/django/db/models/base.py =================================================================== --- django/branches/soc2010/query-refactor/django/db/models/base.py 2010-07-01 01:45:44 UTC (rev 13407) +++ django/branches/soc2010/query-refactor/django/db/models/base.py 2010-07-01 01:53:05 UTC (rev 13408) @@ -5,7 +5,7 @@ import django.db.models.manager # Imported to register signal handler. from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS from django.core import validators -from django.db.models.fields import AutoField, FieldDoesNotExist +from django.db.models.fields import BaseAutoField, FieldDoesNotExist from django.db.models.fields.related import OneToOneRel, ManyToOneRel, OneToOneField from django.db.models.query import delete_objects, Q from django.db.models.query_utils import CollectedObjects, DeferredAttribute @@ -514,8 +514,10 @@ if not pk_set: if force_update: raise ValueError("Cannot force an update in save() with no primary key.") - values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True), connection=connection)) - for f in meta.local_fields if not isinstance(f, AutoField)] + values = [ + (f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True), connection=connection)) + for f in meta.local_fields if not isinstance(f, BaseAutoField) + ] else: values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname) or f.pre_save(self, True), connection=connection)) for f in meta.local_fields] -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.