Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. Database – 100 points
- class Director(models.Model):
- full_name = models.CharField(max_length=120, validators=[MinLengthValidatior(2)])
- birth_date = models.DateField(default='1900-01-01')
- nationality = models.CharField(max_length=50, default='Unknown')
- years_of_experience = models.SmallIntegerField(default=0, validators=[MinValueValidator(0)])
- class Actor(models.Model):
- full_name = models.CharField(max_length=120, validators=[MinLengthValidatior(2)])
- birth_date = models.DateField(default='1900-01-01')
- nationality = models.CharField(max_length=50, default='Unknown')
- is_awarded = models.BooleanField(default=False)
- last_updated = models.DateTimeField(auto_now=True)
- class Movie(models.Model):
- GENRE_CHOICES = (
- ('Action', 'Action'),
- ('Comedy', 'Comedy'),
- ('Drama', 'Drama'),
- ('Other', 'Other')
- )
- title = models.CharField(max_length=150, validatiors=[MinLengthValidatior(5)])
- release_date = models.DateField()
- storyline = models.TextField(null=True, blank=True)
- genre = models.CharField(max_length=6, default='Other')
- rating = models.DecimalField(max_digits=3, decimal_places=1, validators=[validators.MinValueValidator(0), validators.MaxValueValidator(10)], default=0)
- is_classic = models.BooleanField(default=False)
- is_awarded = models.BooleanField(default=False)
- last_updated = models.DateTimeField(auto_now=True)
- director = models.ForeignKey("Director", on_delete=models.CASCADE)
- starring_actor = models.ForeignKey("Actor", null=True, on_delete=models.SET_NULL)
- actors = models.ManyToManyField("Actor")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement