mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
[soc2009/multidb] Removed _meta.using. This shouldn't be a model-level property. Patch from Russell Keith-Magee.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11770 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
da909ae3a0
commit
f0b8874479
1
TODO
1
TODO
@ -10,7 +10,6 @@ Required for v1.2
|
||||
* Resolve the public facing UI issues around using multi-db
|
||||
* Should we take the opportunity to modify DB backends to use fully qualified paths?
|
||||
* Should we clean up DATABASES['DATABASE_NAME'] to DATABASES['NAME'] etc?
|
||||
* Meta.using? Is is still required/desirable?
|
||||
* Cleanup of new API entry points
|
||||
* validate() on a field
|
||||
* name/purpose clash with Honza?
|
||||
|
@ -438,7 +438,7 @@ class Model(object):
|
||||
need for overrides of save() to pass around internal-only parameters
|
||||
('raw', 'cls', and 'origin').
|
||||
"""
|
||||
using = using or self._state.db or self._meta.using or DEFAULT_DB_ALIAS
|
||||
using = using or self._state.db or DEFAULT_DB_ALIAS
|
||||
connection = connections[using]
|
||||
assert not (force_insert and force_update)
|
||||
if cls is None:
|
||||
@ -591,7 +591,7 @@ class Model(object):
|
||||
parent_obj._collect_sub_objects(seen_objs)
|
||||
|
||||
def delete(self, using=None):
|
||||
using = using or self._state.db or self._meta.using or DEFAULT_DB_ALIAS
|
||||
using = using or self._state.db or DEFAULT_DB_ALIAS
|
||||
connection = connections[using]
|
||||
assert self._get_pk_val() is not None, "%s object can't be deleted because its %s attribute is set to None." % (self._meta.object_name, self._meta.pk.attname)
|
||||
|
||||
|
@ -21,7 +21,7 @@ get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|
|
||||
DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
|
||||
'unique_together', 'permissions', 'get_latest_by',
|
||||
'order_with_respect_to', 'app_label', 'db_tablespace',
|
||||
'abstract', 'managed', 'proxy', 'using', 'auto_created')
|
||||
'abstract', 'managed', 'proxy', 'auto_created')
|
||||
|
||||
class Options(object):
|
||||
def __init__(self, meta, app_label=None):
|
||||
@ -47,7 +47,6 @@ class Options(object):
|
||||
self.proxy_for_model = None
|
||||
self.parents = SortedDict()
|
||||
self.duplicate_targets = {}
|
||||
self.using = None
|
||||
self.auto_created = False
|
||||
|
||||
# To handle various inheritance situations, we need to track where
|
||||
|
@ -25,20 +25,14 @@ class QuerySet(object):
|
||||
"""
|
||||
Represents a lazy database lookup for a set of objects.
|
||||
"""
|
||||
def __init__(self, model=None, query=None):
|
||||
def __init__(self, model=None, query=None, using=None):
|
||||
self.model = model
|
||||
# EmptyQuerySet instantiates QuerySet with model as None
|
||||
if model:
|
||||
using = model._meta.using
|
||||
else:
|
||||
using = None
|
||||
using = using or DEFAULT_DB_ALIAS
|
||||
connection = connections[using]
|
||||
self.db = using or DEFAULT_DB_ALIAS
|
||||
self.query = query or sql.Query(self.model)
|
||||
self._result_cache = None
|
||||
self._iter = None
|
||||
self._sticky_filter = False
|
||||
self.db = using
|
||||
|
||||
########################
|
||||
# PYTHON MAGIC METHODS #
|
||||
|
@ -4,8 +4,9 @@
|
||||
Model ``Meta`` options
|
||||
======================
|
||||
|
||||
This document explains all the possible :ref:`metadata options <meta-options>` that you can give your model in its internal
|
||||
``class Meta``.
|
||||
This document explains all the possible :ref:`metadata options
|
||||
<meta-options>` that you can give your model in its internal ``class
|
||||
Meta``.
|
||||
|
||||
Available ``Meta`` options
|
||||
==========================
|
||||
@ -220,17 +221,6 @@ set of fields::
|
||||
|
||||
unique_together = ("driver", "restaurant")
|
||||
|
||||
``using``
|
||||
---------
|
||||
|
||||
.. attribute:: Options.using
|
||||
|
||||
The alias for the default database to be used for this model. If this is not
|
||||
provided the default is ``'default'``. If it is porvided it can be overidden
|
||||
at the ``QuerySet`` level with the ``using()`` method.
|
||||
|
||||
.. versionadded:: 1.2
|
||||
|
||||
``verbose_name``
|
||||
----------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user