Created
August 9, 2018 13:33
-
-
Save moacirmoda/0831b87112028c30482146e84a5b7b64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reporter(models.Model): | |
# ... | |
pass | |
class Article(models.Model): | |
reporter = models.ForeignKey(Reporter, on_delete=models.CASCADE, related_query_name='author') | |
>>> Article.objects.filter(author__name='Moacir') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment