Answer the question
In order to leave comments, you need to log in
How to add video to django blog?
Hello to all! Let me start off by saying that I am new to programming. I wrote in the FileField models and the paths where it should save them, but I didn’t understand what to write in views and templates (what tags to write) so that everything is displayed correctly on the site. Thanks to everyone in advance!
Answer the question
In order to leave comments, you need to log in
models.py:
from transliterate import translit
def upload_location(instance,filename):
return "%s/%s" %('video',translit(filename,'ru',reversed=True))
...
class ClassName(models.Model):
...
file = models.FileField(upload_to=upload_location,blank=True,null=True)
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question