diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-08 10:59:35 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-08 10:59:35 +0000 |
| commit | 1c53661bd14cbb19138bd7f9dbc03074c58d63c2 (patch) | |
| tree | e9928b76b954192c39e0683c56efd553484435cd /django | |
| parent | 0839a0046a09bc80a9cfe02dcc462cb9e4dc2521 (diff) | |
Moved generic relations into django.contrib.contenttypes, since it depends on
that to work. Backwards incompatible change.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/contenttypes/generic.py (renamed from django/db/models/fields/generic.py) | 0 | ||||
| -rw-r--r-- | django/core/management.py | 4 | ||||
| -rw-r--r-- | django/db/models/__init__.py | 1 | ||||
| -rw-r--r-- | django/db/models/query.py | 8 |
4 files changed, 6 insertions, 7 deletions
diff --git a/django/db/models/fields/generic.py b/django/contrib/contenttypes/generic.py index f995ab2044..f995ab2044 100644 --- a/django/db/models/fields/generic.py +++ b/django/contrib/contenttypes/generic.py diff --git a/django/core/management.py b/django/core/management.py index b086663002..8785798abc 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -241,14 +241,14 @@ def _get_sql_for_pending_references(model, pending_references): def _get_many_to_many_sql_for_model(model): from django.db import backend, get_creation_module - from django.db.models import GenericRel + from django.contrib.contenttypes import generic data_types = get_creation_module().DATA_TYPES opts = model._meta final_output = [] for f in opts.many_to_many: - if not isinstance(f.rel, GenericRel): + if not isinstance(f.rel, generic.GenericRel): table_output = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + \ style.SQL_TABLE(backend.quote_name(f.m2m_db_table())) + ' ('] table_output.append(' %s %s %s,' % \ diff --git a/django/db/models/__init__.py b/django/db/models/__init__.py index ccd60023f9..6c3abb6b59 100644 --- a/django/db/models/__init__.py +++ b/django/db/models/__init__.py @@ -8,7 +8,6 @@ from django.db.models.manager import Manager from django.db.models.base import Model, AdminOptions from django.db.models.fields import * from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel, TABULAR, STACKED -from django.db.models.fields.generic import GenericRelation, GenericRel, GenericForeignKey from django.db.models import signals from django.utils.functional import curry from django.utils.text import capfirst diff --git a/django/db/models/query.py b/django/db/models/query.py index 87af774a36..08a7901d6f 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1,9 +1,9 @@ from django.db import backend, connection, transaction from django.db.models.fields import DateField, FieldDoesNotExist -from django.db.models.fields.generic import GenericRelation -from django.db.models import signals +from django.db.models import signals, loading from django.dispatch import dispatcher from django.utils.datastructures import SortedDict +from django.contrib.contenttypes import generic import operator import re @@ -1041,7 +1041,7 @@ def delete_objects(seen_objs): pk_list = [pk for pk,instance in seen_objs[cls]] for related in cls._meta.get_all_related_many_to_many_objects(): - if not isinstance(related.field, GenericRelation): + if not isinstance(related.field, generic.GenericRelation): for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE): cursor.execute("DELETE FROM %s WHERE %s IN (%s)" % \ (qn(related.field.m2m_db_table()), @@ -1049,7 +1049,7 @@ def delete_objects(seen_objs): ','.join(['%s' for pk in pk_list[offset:offset+GET_ITERATOR_CHUNK_SIZE]])), pk_list[offset:offset+GET_ITERATOR_CHUNK_SIZE]) for f in cls._meta.many_to_many: - if isinstance(f, GenericRelation): + if isinstance(f, generic.GenericRelation): from django.contrib.contenttypes.models import ContentType query_extra = 'AND %s=%%s' % f.rel.to._meta.get_field(f.content_type_field_name).column args_extra = [ContentType.objects.get_for_model(cls).id] |
