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:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user