You see, I have the following view:
class contenido_adicional(View):
def get(self,request):
form=bonus()
return render(request,'privilegio.html',{'forma':form})
def post(self,request):
form=bonus(request.POST)
if form.is_valid():
tex=form.cleaned_data['texto']
ani=form.cleaned_data['animal']
documento=extra(texto=tex,animal=ani)
documento.save()
return HttpResponseRedirect('/')
return render(request,'privilegio.html',{'forma':form})
I want to make that view can only be accessed by a user with an open session. I know that if I want a request type view that does not enter a user without a session, I can use @login_required, but this does not work in view views.