mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Fixed #22476: Couldn't alter attributes on M2Ms with through= set
This commit is contained in:
parent
5ea34f3f86
commit
b25aee3b7b
4 changed files with 49 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue