magic-removal: Negligible formatting cleanup in models/manager.py
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2127 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1833c53b21
commit
e865477593
|
@ -17,7 +17,7 @@ def ensure_default_manager(sender):
|
||||||
# Create the default manager, if needed.
|
# Create the default manager, if needed.
|
||||||
if hasattr(cls, 'objects'):
|
if hasattr(cls, 'objects'):
|
||||||
raise ValueError, "Model %s must specify a custom Manager, because it has a field named 'objects'" % name
|
raise ValueError, "Model %s must specify a custom Manager, because it has a field named 'objects'" % name
|
||||||
cls.add_to_class('objects', Manager())
|
cls.add_to_class('objects', Manager())
|
||||||
cls.objects._prepare()
|
cls.objects._prepare()
|
||||||
|
|
||||||
dispatcher.connect(ensure_default_manager, signal=signals.class_prepared)
|
dispatcher.connect(ensure_default_manager, signal=signals.class_prepared)
|
||||||
|
@ -43,7 +43,7 @@ class Manager(object):
|
||||||
# TODO: Use weakref because of possible memory leak / circular reference.
|
# TODO: Use weakref because of possible memory leak / circular reference.
|
||||||
self.klass = klass
|
self.klass = klass
|
||||||
dispatcher.connect(self._prepare, signal=signals.class_prepared, sender=klass)
|
dispatcher.connect(self._prepare, signal=signals.class_prepared, sender=klass)
|
||||||
setattr(klass,name, ManagerDescriptor(self))
|
setattr(klass, name, ManagerDescriptor(self))
|
||||||
if not hasattr(klass, '_default_manager') or \
|
if not hasattr(klass, '_default_manager') or \
|
||||||
self.creation_counter < klass._default_manager.creation_counter:
|
self.creation_counter < klass._default_manager.creation_counter:
|
||||||
klass._default_manager = self
|
klass._default_manager = self
|
||||||
|
|
Loading…
Reference in New Issue