Skip to content

Instantly share code, notes, and snippets.

@menecio
Last active September 7, 2019 09:29
Show Gist options
  • Save menecio/423eb15fd62e21db04807483bd7abc73 to your computer and use it in GitHub Desktop.
Save menecio/423eb15fd62e21db04807483bd7abc73 to your computer and use it in GitHub Desktop.
Our Movie model
from django.db import models
class Movie(models.Model):
release_date = models.DateField()
title = models.CharField(max_length=512)
rating = models.PositiveSmallIntegerField()
duration = models.DurationField()
director = models.CharField(max_length=512)
genre = models.CharField(max_length=16)
def __str__(self):
return f'{self.title} - {self.release_date.year}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment