в settings.py
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
models.py
class Film(models.Model): # Фильм
name = models.CharField(max_length = 150)
duration_film = models.TimeField() # '14:30'
desc = models.TextField()
year = models.PositiveSmallIntegerField("Дата выхода", default=2019)
contry = models.CharField(max_length = 150)
genre = models.ManyToManyField(Genre, verbose_name="жанры")
actor = models.ManyToManyField(Actor, verbose_name="актеры", related_name="film_actor")
directors = models.ManyToManyField(Actor, verbose_name="режиссер", related_name="film_director")
premiere = models.CharField(max_length = 150)
budget = models.PositiveIntegerField()
image = models.ImageField(upload_to = 'media/posters/')
def __str__(self):
return self.name