mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Fixed #29135 -- Prevented get_object/list_or_404() from hiding AttributeError raised by QuerySet filtering.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user