mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #25354 -- Added class/app_label interpolation for related_query_name.
This commit is contained in:
parent
5453aa66cf
commit
f05722a08a
6 changed files with 63 additions and 18 deletions
|
@ -72,6 +72,15 @@ class ModelInheritanceTests(TestCase):
|
|||
AttributeError, getattr, post, "attached_%(class)s_set"
|
||||
)
|
||||
|
||||
def test_model_with_distinct_related_query_name(self):
|
||||
self.assertQuerysetEqual(Post.objects.filter(attached_model_inheritance_comments__is_spam=True), [])
|
||||
|
||||
# The Post model doesn't have a related query accessor based on
|
||||
# related_name (attached_comment_set).
|
||||
msg = "Cannot resolve keyword 'attached_comment_set' into field."
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
Post.objects.filter(attached_comment_set__is_spam=True)
|
||||
|
||||
def test_meta_fields_and_ordering(self):
|
||||
# Make sure Restaurant and ItalianRestaurant have the right fields in
|
||||
# the right order.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue