urls.pyfrom django.conf.urls import url
from staff import views
urlpatterns = [
url(r'^$', views.index, name='staff'),
url(r'(?P<username>[-\w]+)/$', views.user, name='user'),
url(r'(?P<username>[-\w]+)/logout/$', views.logout, name='user_logout'),
]
views.pydef user(request, username):
print('user')
return render(request, 'staff/index.html', locals())
def logout(request, username):
print('test')
auth.logout(request)
username = None
print('test')
return redirect('staff/index.html', locals())
index.html<a href="{% url 'user_logout' user %}" class="btn btn-sm btn-danger ion-log-out">Выход</a>
При нажатии на ссылку отрабатывает view.index, а не view.loguot.