Skip to content

Instantly share code, notes, and snippets.

@moacirmoda
Created August 9, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moacirmoda/0831b87112028c30482146e84a5b7b64 to your computer and use it in GitHub Desktop.
Save moacirmoda/0831b87112028c30482146e84a5b7b64 to your computer and use it in GitHub Desktop.
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