[Fixed]-Calling specific field on form.save() Django ModelForm

1👍

Whelp, as soon as I posted this I figured it out. Just had to change views.py to the following:

def add_video(request):
    if request.method == "POST":
        form = AddVideo(request.POST)
        if form.is_valid():
            video = form.save()
            return redirect('event_detail', slug=video.event.slug)
    else: 
        form = AddVideo()
    return render(request, 'add_video.html', {'form': form})
👤Josh

Leave a comment