Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active August 25, 2020 06:11
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 velotiotech/573b5c4abec5591835b2335e8422a61f to your computer and use it in GitHub Desktop.
Save velotiotech/573b5c4abec5591835b2335e8422a61f to your computer and use it in GitHub Desktop.
class Author(models.Model):
name = models.CharField(max_length=20)
class Book(models.Model):
name = models.CharField(max_length=20)
author = models.ForeignKey("Author", models.CASCADE, related_name="books")
created_at = models.DateTimeField(auto_now_add=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment