Fixed #22476: Couldn't alter attributes on M2Ms with through= set

This commit is contained in:
Andrew Godwin 2014-05-08 10:33:59 -07:00
parent 5ea34f3f86
commit b25aee3b7b
4 changed files with 49 additions and 3 deletions

View file

@ -24,6 +24,22 @@ class AuthorWithM2M(models.Model):
apps = new_apps
class AuthorWithM2MThrough(models.Model):
name = models.CharField(max_length=255)
tags = models.ManyToManyField("schema.TagM2MTest", related_name="authors", through="AuthorTag")
class Meta:
apps = new_apps
class AuthorTag(models.Model):
author = models.ForeignKey("schema.AuthorWithM2MThrough")
tag = models.ForeignKey("schema.TagM2MTest")
class Meta:
apps = new_apps
class Book(models.Model):
author = models.ForeignKey(Author)
title = models.CharField(max_length=100, db_index=True)