mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #14471 -- Corrected a regression in the use of methods on custom managers on related querysets. Thanks to Lucky for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -30,7 +30,21 @@ class Person(models.Model):
|
||||
class Meta:
|
||||
ordering = ('name',)
|
||||
|
||||
# This book manager doesn't do anything interesting; it just
|
||||
# exists to strip out the 'extra_arg' argument to certain
|
||||
# calls. This argument is used to establish that the BookManager
|
||||
# is actually getting used when it should be.
|
||||
class BookManager(models.Manager):
|
||||
def create(self, *args, **kwargs):
|
||||
kwargs.pop('extra_arg', None)
|
||||
return super(BookManager, self).create(*args, **kwargs)
|
||||
|
||||
def get_or_create(self, *args, **kwargs):
|
||||
kwargs.pop('extra_arg', None)
|
||||
return super(BookManager, self).get_or_create(*args, **kwargs)
|
||||
|
||||
class Book(models.Model):
|
||||
objects = BookManager()
|
||||
title = models.CharField(max_length=100)
|
||||
published = models.DateField()
|
||||
authors = models.ManyToManyField(Person)
|
||||
@@ -60,4 +74,3 @@ class UserProfile(models.Model):
|
||||
|
||||
class Meta:
|
||||
ordering = ('flavor',)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user