mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[BoulderSprint] ensure default table names aren't too long
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6267678653
commit
2245b599a7
@ -59,6 +59,8 @@ class Options(object):
|
||||
del self.meta
|
||||
|
||||
def _prepare(self, model):
|
||||
from django.db import backend
|
||||
from django.db.backends.util import truncate_name
|
||||
if self.order_with_respect_to:
|
||||
self.order_with_respect_to = self.get_field(self.order_with_respect_to)
|
||||
self.ordering = ('_order',)
|
||||
@ -73,6 +75,8 @@ class Options(object):
|
||||
# If the db_table wasn't provided, use the app_label + module_name.
|
||||
if not self.db_table:
|
||||
self.db_table = "%s_%s" % (self.app_label, self.module_name)
|
||||
self.db_table = truncate_name(self.db_table,
|
||||
backend.get_max_name_length)
|
||||
|
||||
def add_field(self, field):
|
||||
# Insert the given field in the order in which it was created, using
|
||||
|
Loading…
x
Reference in New Issue
Block a user