Author: russellm
Date: 2010-01-18 19:25:30 -0600 (Mon, 18 Jan 2010)
New Revision: 12262
Modified:
django/trunk/django/db/backends/creation.py
Log:
Fixed #12633 -- Modified some old m2m attribute use in deprecated m2m table
creation methods. Also added PendingDeprecation warnings to those methods.
Thanks to Alex for the suggestion, and Ramiro for the report and fix.
Modified: django/trunk/django/db/backends/creation.py
===================================================================
--- django/trunk/django/db/backends/creation.py 2010-01-19 01:14:02 UTC (rev
12261)
+++ django/trunk/django/db/backends/creation.py 2010-01-19 01:25:30 UTC (rev
12262)
@@ -145,6 +145,12 @@
def sql_for_many_to_many(self, model, style):
"Return the CREATE TABLE statments for all the many-to-many tables
defined on a model"
+ import warnings
+ warnings.warn(
+ 'Database creation API for m2m tables has been deprecated. M2M
models are now automatically generated',
+ PendingDeprecationWarning
+ )
+
output = []
for f in model._meta.local_many_to_many:
if model._meta.managed or f.rel.to._meta.managed:
@@ -153,11 +159,17 @@
def sql_for_many_to_many_field(self, model, f, style):
"Return the CREATE TABLE statements for a single m2m field"
+ import warnings
+ warnings.warn(
+ 'Database creation API for m2m tables has been deprecated. M2M
models are now automatically generated',
+ PendingDeprecationWarning
+ )
+
from django.db import models
from django.db.backends.util import truncate_name
output = []
- if f.creates_table:
+ if f.auto_created:
opts = model._meta
qn = self.connection.ops.quote_name
tablespace = f.db_tablespace or opts.db_tablespace
@@ -210,6 +222,12 @@
def sql_for_inline_many_to_many_references(self, model, field, style):
"Create the references to other tables required by a many-to-many
table"
+ import warnings
+ warnings.warn(
+ 'Database creation API for m2m tables has been deprecated. M2M
models are now automatically generated',
+ PendingDeprecationWarning
+ )
+
from django.db import models
opts = model._meta
qn = self.connection.ops.quote_name
@@ -306,9 +324,15 @@
def sql_destroy_many_to_many(self, model, f, style):
"Returns the DROP TABLE statements for a single m2m field"
+ import warnings
+ warnings.warn(
+ 'Database creation API for m2m tables has been deprecated. M2M
models are now automatically generated',
+ PendingDeprecationWarning
+ )
+
qn = self.connection.ops.quote_name
output = []
- if f.creates_table:
+ if f.auto_created:
output.append("%s %s;" % (style.SQL_KEYWORD('DROP TABLE'),
style.SQL_TABLE(qn(f.m2m_db_table()))))
ds = self.connection.ops.drop_sequence_sql("%s_%s" %
(model._meta.db_table, f.column))
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.