I have a FileField like this:
class Post(models.Model):
file = models.FileField(null=True, blank=True)
video = models.BooleanField(default=False)
I'm then able to look at the object when it goes past my views
:
def post(request):
if request.user.is_authenticated():
form_post = FileForm(request.POST or None, request.FILES or None)
if form_post.is_valid():
instance = form_post.save(commit=False)
if ?something?:
instance.video = True
instance.save()
So in my view is it possible to check whether the Post.file is a video or image?