1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[soc2009/multidb] Cleaned up the interaction between managers and the using() method by the addition of a db_manager() method.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor
2009-12-18 01:31:53 +00:00
parent 601db0d2df
commit e95bc7b50d
13 changed files with 78 additions and 50 deletions

View File

@@ -17,8 +17,8 @@ class Review(models.Model):
ordering = ('source',)
class PersonManager(models.Manager):
def get_by_natural_key(self, name, using=None):
return self.using(using).get(name=name)
def get_by_natural_key(self, name):
return self.get(name=name)
class Person(models.Model):
objects = PersonManager()

View File

@@ -632,7 +632,7 @@ class UserProfileTestCase(TestCase):
def test_user_profiles(self):
alice = User.objects.create_user('alice', 'alice@example.com')
bob = User.objects.create_user('bob', 'bob@example.com', using='other')
bob = User.objects.db_manager('other').create_user('bob', 'bob@example.com')
alice_profile = UserProfile(user=alice, flavor='chocolate')
alice_profile.save()