mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Fixed #23915 -- Made sure m2m fields through non-pk to_field are allowed in the admin.
refs #23754, #23862
This commit is contained in:
parent
f9c4e14aec
commit
3a9aa155e2
3 changed files with 21 additions and 12 deletions
|
@ -855,13 +855,19 @@ class InlineReferer(models.Model):
|
|||
refs = models.ManyToManyField(InlineReference)
|
||||
|
||||
|
||||
# Models for #23604
|
||||
# Models for #23604 and #23915
|
||||
class Recipe(models.Model):
|
||||
pass
|
||||
rname = models.CharField(max_length=20, unique=True)
|
||||
|
||||
|
||||
class Ingredient(models.Model):
|
||||
recipes = models.ManyToManyField(Recipe)
|
||||
iname = models.CharField(max_length=20, unique=True)
|
||||
recipes = models.ManyToManyField(Recipe, through='RecipeIngredient')
|
||||
|
||||
|
||||
class RecipeIngredient(models.Model):
|
||||
ingredient = models.ForeignKey(Ingredient, to_field='iname')
|
||||
recipe = models.ForeignKey(Recipe, to_field='rname')
|
||||
|
||||
|
||||
# Model for #23839
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue