mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Add related_query_name to ForeignKey/M2M. Refs #20244
This commit is contained in:
parent
e26b589b8c
commit
99b467f272
3 changed files with 40 additions and 8 deletions
|
|
@ -150,3 +150,11 @@ class ArticleTranslation(models.Model):
|
|||
class Meta:
|
||||
unique_together = ('article', 'lang')
|
||||
ordering = ('active_translation__title',)
|
||||
|
||||
class ArticleTag(models.Model):
|
||||
article = models.ForeignKey(Article, related_name="tags", related_query_name="tag")
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
class ArticleIdea(models.Model):
|
||||
articles = models.ManyToManyField(Article, related_name="ideas", related_query_name="idea_things")
|
||||
name = models.CharField(max_length=255)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue