我的默認項目文件夾是啓動與登錄應用程序在它。如何在登錄後通過用戶名或用戶名登錄表單提交django
登錄應用urls.py: -
url(r'^$', views.LoginFormView.as_view(), name='index'),
網址登錄頁面。
內登錄應用views.py:提交併重定向到用戶的個人資料頁
LoginFormView(TemplateView):
..........
.........
if user is not None:
if user.is_active:
login(request, user)
# messages.add_message(request, messages.INFO, 'Login Successfull.')
return redirect('indexClient')
登錄表單。
啓動urls.py: -
url(r'^client/', views.IndexClientView.as_view(), name='indexClient'),
啓動views.py: -
class IndexClientView(TemplateView):
template_name = 'startup/index-client.html'
我需要的URL更換客戶與用戶名在登錄時輸入形成。
也許會返回一個HTTP響應而不是重定向,並處理正在執行登錄的前端的重定向? – Zohair