mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #29135 -- Prevented get_object/list_or_404() from hiding AttributeError raised by QuerySet filtering.
This commit is contained in:
parent
9b1125bfc7
commit
eb002e7892
3 changed files with 21 additions and 6 deletions
|
@ -25,11 +25,17 @@ class ArticleManager(models.Manager):
|
|||
return super().get_queryset().filter(authors__name__icontains='sir')
|
||||
|
||||
|
||||
class AttributeErrorManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
raise AttributeError('AttributeErrorManager')
|
||||
|
||||
|
||||
class Article(models.Model):
|
||||
authors = models.ManyToManyField(Author)
|
||||
title = models.CharField(max_length=50)
|
||||
objects = models.Manager()
|
||||
by_a_sir = ArticleManager()
|
||||
attribute_error_objects = AttributeErrorManager()
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue