Ticket #8825: 8825.diff

File 8825.diff, 1.5 KB (added by cgrady, 7 years ago)
  • django/db/models/base.py

     
    9090               
    9191            # All the fields of any type declared on this model
    9292            new_fields = new_class._meta.local_fields + \
    93                          new_class._meta.many_to_many + \
     93                         new_class._meta.local_many_to_many + \
    9494                         new_class._meta.virtual_fields
    9595            field_names = set([f.name for f in new_fields])
    9696               
  • tests/regressiontests/model_inheritance_regress/models.py

     
    7171class ArticleWithAuthor(Article):
    7272    author = models.CharField(max_length=100)
    7373
     74class M2MBase(models.Model):
     75    articles = models.ManyToManyField(Article)
     76
     77class M2MChild(M2MBase):
     78    name = models.CharField(max_length=50)
     79
    7480__test__ = {'API_TESTS':"""
    7581# Regression for #7350, #7202
    7682# Check that when you create a Parent object with a specific reference to an
     
    231237    ...
    232238DoesNotExist: ArticleWithAuthor matching query does not exist.
    233239
     240# Regression test for #8825
     241# Verify that ManyToManyField is still present in a child model.
     242
     243>>> len(M2MChild._meta.many_to_many)
     2441
     245
    234246"""}
Back to Top