mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Fixed #22183: Through M2Ms now correctly handled
This commit is contained in:
parent
cdf6eba181
commit
6b07804474
5 changed files with 44 additions and 3 deletions
|
@ -44,6 +44,21 @@ class BookWithM2M(models.Model):
|
|||
apps = new_apps
|
||||
|
||||
|
||||
class TagThrough(models.Model):
|
||||
book = models.ForeignKey("schema.BookWithM2MThrough")
|
||||
tag = models.ForeignKey("schema.TagM2MTest")
|
||||
|
||||
class Meta:
|
||||
apps = new_apps
|
||||
|
||||
|
||||
class BookWithM2MThrough(models.Model):
|
||||
tags = models.ManyToManyField("TagM2MTest", related_name="books", through=TagThrough)
|
||||
|
||||
class Meta:
|
||||
apps = new_apps
|
||||
|
||||
|
||||
class BookWithSlug(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