. . . from django.shortcuts import render, redirect from django.contrib import messages from .forms import PeliculaForm . . . def anadir_pelicula(request): if request.method == 'POST': form = PeliculaForm(request.POST, request.FILES) if form.is_valid(): pelicula = Pelicula() pelicula.titulo = form.cleaned_data['titulo'] pelicula.director = form.cleaned_data['director'] pelicula.genero = form.cleaned_data['genero'] pelicula.save() else: return render(request, 'mispeliculas/nueva_pelicula.html', {'form':form}) return redirect('nueva_pelicula') . . .