0

How can you display either a video or image file in a django template depending on what the uploaded file is?

I want to add both images and videos in my model Post.py but want to display either an image or a video at a time in my django project. I couldn't find the right and satisfactory answers on stackoverflow even. Please do help i really want to know the code.

23rd Jul 2020, 4:44 AM
Parth Lashkari
Parth Lashkari - avatar
2 odpowiedzi
0
If i am writing default image then i can't leave it empty even when i made the imageField blank=True and if i don't write default in imageField then i am getting the image has no field associated with it.
25th Jul 2020, 6:22 PM
Parth Lashkari
Parth Lashkari - avatar