本文整理汇总了Python中account.views.LoginView.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python LoginView.as_view方法的具体用法?Python LoginView.as_view怎么用?Python LoginView.as_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account.views.LoginView
的用法示例。
在下文中一共展示了LoginView.as_view方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: url
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from account.views import LoginView
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.core.urlresolvers import reverse_lazy
urlpatterns = [
url(r'^accounts/login/$', LoginView.as_view(template_name='ldap_login.html'), name='login'),
url(r'^accounts/logout/$',
auth_views.logout,
{'next_page': reverse_lazy('index')},
name='logout'),
url(r'^', include('mentoring.urls')),
url(r'^admin/', include(admin.site.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
handler500 = 'mentoring.views.handler500'
handler404 = 'mentoring.views.handler500'
示例2: test_get
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
def test_get(self):
request = self.factory.get(reverse("account_login"))
request.user = AnonymousUser()
response = LoginView.as_view()(request)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.template_name, ["account/login.html"])
示例3: url
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from account.views import ChangePasswordView, SignupView, LoginView
from django.conf.urls import include, url
from django.contrib import admin
from example_thirdparty.forms import SignupFormWithCaptcha
urlpatterns = [
url(r"^admin/", include(admin.site.urls)),
# aliases to match original django-registration urls
url(r"^accounts/password/$", ChangePasswordView.as_view(), name="auth_password_change"),
url(r"^accounts/signup/$", SignupView.as_view(form_class=SignupFormWithCaptcha), name="registration_register"),
url(r"^accounts/login/$", LoginView.as_view(), name="auth_login"),
url(r"^accounts/", include("account.urls")),
url(r"^captcha/", include("captcha.urls")),
url(r"^", include("pybb.urls", namespace="pybb")),
]
示例4: patterns
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from account.views import SignupView, LoginView, LogoutView, DeleteView
from account.views import ConfirmEmailView
from account.views import ChangePasswordView, PasswordResetView, PasswordResetTokenView
from account.views import SettingsView
urlpatterns = patterns("",
url(r"^signup/$", SignupView.as_view(), name="account_signup"),
url(r"^login/$", LoginView.as_view(), name="account_login"),
url(r"^logout/$", LogoutView.as_view(), name="account_logout"),
url(r"^confirm_email/(?P<key>\w+)/$", ConfirmEmailView.as_view(), name="account_confirm_email"),
url(r"^password/$", ChangePasswordView.as_view(), name="account_password"),
url(r"^password/reset/$", PasswordResetView.as_view(), name="account_password_reset"),
url(r"^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$", PasswordResetTokenView.as_view(), name="account_password_reset_token"),
url(r"^settings/$", SettingsView.as_view(), name="account_settings"),
url(r"^delete/$", DeleteView.as_view(), name="account_delete"),
)
示例5: import
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
# coding=utf-8
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from account.views import (LoginView, MessageView, CheckMessageView,
RegisterView, ResetPasswordView, ProfileView,
FriendsView)
urlpatterns = [
url(r'^login/$', LoginView.as_view(), name='login'),
url(r'^logout/$', auth_views.logout, name='logout'),
url(r'^register$', RegisterView.as_view(), name='register'),
url(r'^send_message$', MessageView.as_view(), name='send_message'),
url(r'^auth_message$', CheckMessageView.as_view(), name='auth_message'),
url(r'^reset_password', ResetPasswordView.as_view(), name='reset_password'),
url(r'^profile', ProfileView.as_view(), name='profile'),
url(r'^friends', FriendsView.as_view(), name='friends'),
]
示例6: import
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
if 'account' in settings.INSTALLED_APPS:
# We use localized URLs in our app. django-user-accounts doesn't. Too bad.
from account.views import (SignupView, LoginView, LogoutView, DeleteView,
ConfirmEmailView, ChangePasswordView,
PasswordResetView, PasswordResetTokenView,
SettingsView)
urlpatterns += i18n_patterns(
"",
url(_(r"^signup/$"), SignupView.as_view(),
name="account_signup"),
# original is: url(_(r"^login/$"), but we prefer:
url(_(ur'^signin/$'), never_cache(LoginView.as_view()),
name="signin"),
# original is: url(_(r"^logout/$"), but we prefer:
url(_(ur'^signout/$'), never_cache(LogoutView.as_view()),
name="signout"),
url(_(r"^confirm_email/(?P<key>\w+)/$"), ConfirmEmailView.as_view(),
name="account_confirm_email"),
url(_(r"^password/$"), ChangePasswordView.as_view(),
name="account_password"),
url(_(r"^password/reset/$"), PasswordResetView.as_view(),
name="account_password_reset"),
url(_(r"^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$"),
PasswordResetTokenView.as_view(),
name="account_password_reset_token"),
url(_(r"^settings/$"), SettingsView.as_view(),
name="account_settings"),
示例7: url
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
from django.conf.urls import url
from account.views import LoginView, RegisterView, UserListView, ProfileDetailView, ProfileUpdateView
from permapp.views import News1CreateView, News1DeleteView, News1DetailView, News1ListView, News1UpdateView
urlpatterns = [
url(r'^login/$', LoginView.as_view(), name="login"),
url(r'^register/$', RegisterView.as_view(), name="register"),
url(r'^users/$', UserListView.as_view(), name="users"),
url(r'^logout/$', 'django.contrib.auth.views.logout',{'next_page': '/'},name="logout"),
url(r'^profile/(?P<pk>\d+)/$', ProfileDetailView.as_view(), name='profile'),
url(r'^profile/(?P<pk>\d+)/edit/$', ProfileUpdateView.as_view(), name='profile-edit'),
url(r'^news1/$', News1ListView.as_view(), name="news1-list"),
url(r'^news1/add/$', News1CreateView.as_view(), name="news1-add"),
url(r'^news1/(?P<pk>\d+)/$', News1DetailView.as_view(), name="news1-detail"),
url(r'^news1/(?P<pk>\d+)/edit/$', News1UpdateView.as_view(), name="news1-edit"),
url(r'^news1/(?P<pk>\d+)/delete/$', News1DeleteView.as_view(), name="news1-delete"),
]
示例8: patterns
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
import settings
from django.conf.urls import patterns, include, url
from account.views import LoginView, RegisterView, logout_view, ResetPassword
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'auth/', include('social_auth.urls')),
url(r'^$', LoginView.as_view(), name="login-view"),
url(r'^register/$', RegisterView.as_view(), name="register-view"),
url(r'^logout/$', logout_view, {'next_page': '/'}, name="logout-view"),
#url(r'^signup/$', SignupView.as_view(), name="sign-up"),
url(r'^lyrics/',include('lyrics.urls')),
url(r'^reset_password',ResetPassword.as_view(), name="reset_password"),
# url(r'^$', 'LyricsManiac.views.home', name='home'),
# url(r'^LyricsManiac/', include('LyricsManiac.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))
示例9: patterns
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
v1_api.register(ListResource())
v1_api.register(UserResource())
v1_api.register(FeedbackResource())
v1_api.register(FollowResource())
v1_api.register(CommentResource())
v1_api.register(ListInvitationResource())
v1_api.register(UserTourResource())
v1_api.register(FeedCountResource())
urlpatterns = patterns("",
url(r"^admin/", include(admin.site.urls)),
#url(r'adminx/', include(xadmin.site.urls)),
url(r'^harvest/', include("harvest.urls")),
url(r"^accounts/signup/$", SignupView.as_view(form_class=SignupForm), name="account_signup"),
url(r"^accounts/settings/$", SettingsView.as_view(form_class=SettingsForm), name="account_settings"),
url(r"^accounts/login/$", LoginView.as_view(form_class=LoginEmailOrUsernameForm), name="account_login"),
url(r'', include('social_auth.urls')),
url(r'misc/', include('misc.urls')),
url(r"^accounts/", include("account.urls")),
url(r'^api/', include(v1_api.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^profiles/profile/(?P<username>\w+)/', redirect_to, {'url': '/profiles/edit'}),
url(r'^help/', direct_to_template, {'template': 'help.html'}, name="help"),
url(r'^about/', direct_to_template, {'template': 'about.html'}, name="about"),
url(r'^profiles/', include('idios.urls')),
url(r'^invite/', include('kaleo.urls')),
url(r'^notifications/', include('notifications.urls', namespace="notifications")),
url(r'^avatar/', include('avatar.urls')),
url(r'^snapshot/', include('snapshot.urls')),
url(r'^note/', include('note.urls')),
示例10: import
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
if 'account' in settings.INSTALLED_APPS:
# We use localized URLs in our app. django-user-accounts doesn't. Too bad.
from account.views import (SignupView, LoginView, LogoutView, DeleteView,
ConfirmEmailView, ChangePasswordView,
PasswordResetView, PasswordResetTokenView,
SettingsView)
urlpatterns += i18n_patterns(
"",
url(_(r"^signup/$"), SignupView.as_view(),
name="account_signup"),
# original is: url(_(r"^login/$"), but we prefer:
url(_(ur'^signin/$'), LoginView.as_view(),
name="signin"),
# original is: url(_(r"^logout/$"), but we prefer:
url(_(ur'^signout/$'), LogoutView.as_view(),
name="signout"),
url(_(r"^confirm_email/(?P<key>\w+)/$"), ConfirmEmailView.as_view(),
name="account_confirm_email"),
url(_(r"^password/$"), ChangePasswordView.as_view(),
name="account_password"),
url(_(r"^password/reset/$"), PasswordResetView.as_view(),
name="account_password_reset"),
url(_(r"^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$"),
PasswordResetTokenView.as_view(),
name="account_password_reset_token"),
url(_(r"^settings/$"), SettingsView.as_view(),
name="account_settings"),
示例11: patterns
# 需要导入模块: from account.views import LoginView [as 别名]
# 或者: from account.views.LoginView import as_view [as 别名]
from django.conf.urls import patterns, url
from account.views import LoginView, RegisterView, account_view, LogoutView
urlpatterns = patterns('',
url(r'^login/$', LoginView.as_view(), name="account-login"),
url(r'^logout/$', LogoutView.as_view(), name="account-logout"),
url(r'^register/$', RegisterView.as_view(), name="account-register"),
url(r'^$', account_view, name="account-page")
)