python - Django Login Require Issues -


i sorry if question obvious still new django.

i have view:

import logging  @login_required(login_url='/accounts/login/')  def index(request):         return render(request, 'post.html', {})  def new(request):     return render(request, 'post-add.html',) 

the login redirects correctly if go post page if got post add login not required.

am using login require correctly ?

if want redirect when try open "post-add" without login, need decorator(@login_required(login_url='/accounts/login/') ).


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -