Error running project migrated from Django 1.7 to Django 1.10

Asked

Viewed 30 times

0

I am migrating a project done in Django 1.7 to Django 1.10, when I try to run the project I get the error:

The view core.config.views.home didn’t Return an Httpresponse Object. It returned None Instead.

by which I could understand this and on account of the Verse that was discontinued, the view that the error refers to and the following:

@login_required
def home(request):
    dados={}
    if request.user.has_perm('admin'):
        return render(request, 'Template_Error.html',{'mensagem':"Você não possui permissão para Logar no sistema",'titulo':'Aviso!'})
    if request.user.has_perm('ava.view_professor'):
        return redirect(reverse(viewname='home_professor'))
    elif request.user.has_perm('ava.view_aluno'):
        return redirect(reverse(viewname='home_aluno'))

what is the right way to do this today ?

1 answer

0


In the documentation explains that just pass the name of the view to the redirect that the reverse will be used.

def my_view(request):
...
return redirect('some-view-name', foo='bar')
  • Thank you, I believe this will solve my problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.