Answer the question
In order to leave comments, you need to log in
Why, when adding an image to the database through the admin panel, create two media folders ???
in settings.py
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question