#36295: Unable to Override GenericForeignKey in Inherited Abstract Class
-------------------------------------+-------------------------------------
     Reporter:  Gagan Deep           |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

 * stage:  Unreviewed => Accepted

Comment:

 Thank you!
 Using the models as defined above, I was able to replicate

 {{{#!diff
 diff --git a/tests/generic_relations/tests.py
 b/tests/generic_relations/tests.py
 index e0c6fe2db7..c4163f3c87 100644
 --- a/tests/generic_relations/tests.py
 +++ b/tests/generic_relations/tests.py
 @@ -1,6 +1,6 @@
  from django.contrib.contenttypes.models import ContentType
  from django.contrib.contenttypes.prefetch import GenericPrefetch
 -from django.core.exceptions import FieldError
 +from django.core.exceptions import FieldError, FieldDoesNotExist
  from django.db.models import Q, prefetch_related_objects
  from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature

 @@ -9,6 +9,7 @@ from .models import (
      Animal,
      Carrot,
      Comparison,
 +    ConcreteEntity,
      ConcreteRelatedModel,
      ForConcreteModelModel,
      ForProxyModelModel,
 @@ -780,6 +781,12 @@ class GenericRelationsTests(TestCase):
                  self.platypus.latin_name,
              )

 +    def test_overwriting_generic_fk(self):
 +        with self.assertRaises(FieldDoesNotExist):
 +            ConcreteEntity._meta.get_field('description')
 +        with self.assertRaises(FieldDoesNotExist):
 +            ConcreteEntity._meta.get_field('related_object')
 +

  class ProxyRelatedModelTest(TestCase):
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36295#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070195fc201ff6-77e3323b-73d4-4134-b8ef-fa580d7dbe24-000000%40eu-central-1.amazonses.com.

Reply via email to