diff --git a/django/db/models/options.py b/django/db/models/options.py
index a302e2d..2136741 100644
a
|
b
|
class Options(object):
|
71 | 71 | self.related_fkey_lookups = [] |
72 | 72 | |
73 | 73 | def contribute_to_class(self, cls, name): |
74 | | from django.db import connection |
| 74 | from django.db import connections, router |
75 | 75 | from django.db.backends.util import truncate_name |
76 | 76 | |
77 | 77 | cls._meta = self |
… |
… |
class Options(object):
|
119 | 119 | |
120 | 120 | # If the db_table wasn't provided, use the app_label + model_name. |
121 | 121 | if not self.db_table: |
| 122 | db = router.db_for_read(self.model) |
122 | 123 | self.db_table = "%s_%s" % (self.app_label, self.model_name) |
123 | | self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) |
| 124 | self.db_table = truncate_name(self.db_table, connections[db].ops.max_name_length()) |
124 | 125 | |
125 | 126 | @property |
126 | 127 | def module_name(self): |