1
0
mirror of https://github.com/django/django.git synced 2025-07-05 10:19:20 +00:00

[multi-db] Removed connection information and db_connection from model Meta.

git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jason Pellerin 2006-07-19 02:31:44 +00:00
parent 22afa65b4b
commit e0486bd7a7

View File

@ -12,7 +12,7 @@ import re
# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip()
DEFAULT_NAMES = ('verbose_name', 'db_connection', 'db_table', 'ordering',
DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
'unique_together', 'permissions', 'get_latest_by',
'order_with_respect_to', 'app_label')
@ -21,7 +21,6 @@ class Options(object):
self.fields, self.many_to_many = [], []
self.module_name, self.verbose_name = None, None
self.verbose_name_plural = None
self.db_connection = None
self.db_table = ''
self.ordering = []
self.unique_together = []
@ -93,17 +92,6 @@ class Options(object):
def __str__(self):
return "%s.%s" % (self.app_label, self.module_name)
def get_connection_info(self):
if self.db_connection:
return connections[self.db_connection]
return connection_info
connection_info = property(get_connection_info)
def get_connection(self):
"""Get the database connection for this object's model"""
return self.get_connection_info().connection
connection = property(get_connection)
def get_field(self, name, many_to_many=True):
"Returns the requested field by name. Raises FieldDoesNotExist on error."
to_search = many_to_many and (self.fields + self.many_to_many) or self.fields