mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #7588 -- Inherit fields from concrete ancestor classes via abstract base
classes. Based on a patch from emulbreh. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8932 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9a89d1eb9f
commit
d88688014f
2 changed files with 23 additions and 3 deletions
|
@ -77,6 +77,16 @@ class M2MBase(models.Model):
|
|||
class M2MChild(M2MBase):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
class Evaluation(Article):
|
||||
quality = models.IntegerField()
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class QualityControl(Evaluation):
|
||||
assignee = models.CharField(max_length=50)
|
||||
|
||||
|
||||
__test__ = {'API_TESTS':"""
|
||||
# Regression for #7350, #7202
|
||||
# Check that when you create a Parent object with a specific reference to an
|
||||
|
@ -242,4 +252,9 @@ DoesNotExist: ArticleWithAuthor matching query does not exist.
|
|||
>>> M2MChild.objects.filter(articles__isnull=False)
|
||||
[]
|
||||
|
||||
# All fields from an ABC, including those inherited non-abstractly should be
|
||||
# available on child classes (#7588). Creating this instance should work
|
||||
# without error.
|
||||
>>> _ = QualityControl.objects.create(headline="Problems in Django", pub_date=datetime.datetime.now(), quality=10, assignee="adrian")
|
||||
|
||||
"""}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue