summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBoulder Sprinters <boulder-sprinters@djangoproject.com>2006-11-05 01:22:06 +0000
committerBoulder Sprinters <boulder-sprinters@djangoproject.com>2006-11-05 01:22:06 +0000
commit93bfe7f18e4ccb2c13d5ed14a0a71c5f0c94dd63 (patch)
tree9989ff403d33af33660aa6fd3e11456c75b6dc6e /django
parent2245b599a71c7c6da5c5709d7d36f71082342a66 (diff)
downloaddjango-93bfe7f18e4ccb2c13d5ed14a0a71c5f0c94dd63.tar.gz
truncate_name if needed
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4016 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/related.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index bd9262d55a..ad78a01252 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -632,7 +632,10 @@ class ManyToManyField(RelatedField, Field):
def _get_m2m_db_table(self, opts):
"Function that can be curried to provide the m2m table name for this relation"
- return '%s_%s' % (opts.db_table, self.name)
+ from django.db import backend
+ from django.db.backends.util import truncate_name
+ name = '%s_%s' % (opts.db_table, self.name)
+ return truncate_name(name, backend.get_max_name_length())
def _get_m2m_column_name(self, related):
"Function that can be curried to provide the source column name for the m2m table"