How to upload a video to django ?

I want to upload a video via a ModelForm to my view to process it then display the result in the front-end.

My approach is:

models.py

from django.db import models

class Video_upload(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
video = models.FileField(blank=True,upload_to=‘static/video/’)

forms.py

from django.db import models
from django import forms
from django.forms import ModelForm

from myapp.models import Video_upload

class VideoUploadForm(ModelForm):
    video = forms.FileField(required=False, error_messages = {'invalid':("Video files only")}, widget=forms.FileInput)
    class Meta:
        model = Video_upload
        fields = ['video']

views.py

def main(request):
    template = loader.get_template('index.html')
            model_db = Model_info.objects.get(id=chosen_model)
        if request.POST:
            form = VideoUploadForm(request.POST, request.FILES)
            # video_form = VideoUploadForm(request.POST,request.FILES)
            if form.is_valid():
                # get uploaded video
                uploaded = form.cleaned_data['video']
                v_name = request.FILES['video'].name
                [[[[[ ??My question is here??]]]]]

How do I get the video that was uploaded through the form ? I can get its name only.

Notice that I don’t want to store it permenantly, just temporarily until the processing completes and yeild a result.

If you want to process the video before it’s saved, see the docs at File Uploads | Django documentation | Django , especially the section on Upload Handlers.

Note: If you’re not going to save it, then you do not want to make a model for this, and you don’t want to create the form as a model form. Create a regular form for this and process the file in a handler.

Thank you very much @KenWhitesell , I followed the approach you suggested and managed to upload the video successfully.

I used normal form.