當前位置: 首頁>>代碼示例>>Python>>正文


Python views.LogoutView類代碼示例

本文整理匯總了Python中django.contrib.auth.views.LogoutView的典型用法代碼示例。如果您正苦於以下問題:Python LogoutView類的具體用法?Python LogoutView怎麽用?Python LogoutView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了LogoutView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: logout

 def logout(self, request, extra_context=None):
     if request.method == 'POST':
         messages.info(request, _('Thanks for using Weblate!'))
         request.current_app = self.name
         return LogoutView.as_view(next_page=reverse('admin:login'))(request)
     context = self.each_context(request)
     context['title'] = _('Logout')
     return render(request, 'admin/logout-confirm.html', context)
開發者ID:dsnoeck,項目名稱:weblate,代碼行數:8,代碼來源:sites.py

示例2: logout

def logout(request):
    """return the django.contrib.auth or the django-allauth logout view"""
    if settings.USE_ALL_AUTH:
        # noinspection PyPackageRequirements
        from allauth.account.views import logout

        return logout(request)
    return LogoutView.as_view()(request)
開發者ID:d9pouces,項目名稱:django-floor,代碼行數:8,代碼來源:auth.py

示例3: logout

def logout(request, next_page=None,
           template_name='registration/logged_out.html',
           redirect_field_name=REDIRECT_FIELD_NAME):
    was_wind_login = SESSION_KEY in request.session
    django_logout(request)
    statsd.incr('djangowind.logout')
    if was_wind_login and hasattr(settings, 'CAS_BASE'):
        return HttpResponseRedirect('%scas/logout' % settings.CAS_BASE)
    else:
        return LogoutView.as_view()(
            request, next_page, template_name, redirect_field_name)
開發者ID:ccnmtl,項目名稱:djangowind,代碼行數:11,代碼來源:views.py

示例4: logout

def logout(request, extra_context=None):
    """
    Log out the user.

    This should *not* assume the user is already logged in.
    """
    extra_context = extra_context or {}
    # Since the user isn't logged out at this point, the value of has_permission must be overridden.
    extra_context['has_permission'] = False
    defaults = view_defaults(
        extra_context=extra_context,
        next_page=reverse(
            'index', current_app=request.resolver_match.app_name))
    return LogoutView.as_view(**defaults)(request)
開發者ID:imdario,項目名稱:shipanaro,代碼行數:14,代碼來源:views.py

示例5: logout

    def logout(self, request, extra_context=None):
        """
        Logs out the user for the given HttpRequest.

        This should *not* assume the user is already logged in.
        """
        from django.contrib.auth.views import LogoutView
        defaults = {
            'extra_context': dict(
                self.each_context(request),
                # Since the user isn't logged out at this point, the value of
                # has_permission must be overridden.
                has_permission=False,
                **(extra_context or {})
            ),
        }
        if self.logout_template is not None:
            defaults['template_name'] = self.logout_template
        request.current_app = self.name
        return LogoutView.as_view(**defaults)(request)
開發者ID:AleksejManaev,項目名稱:django,代碼行數:20,代碼來源:sites.py

示例6: path

from django.shortcuts import render
from django.urls import path
from robots.views import rules_list
from sitegate.toolbox import get_sitegate_urls
from sitemessage.toolbox import get_sitemessage_urls

from apps.realms import bootstrap_realms  # Здесь относительный импорт работать не будет.
from apps.views import page_not_found, permission_denied, server_error, index, search, login, telebot, user_settings

urlpatterns = [
    path('', index, name='index'),
    path('search/site/', render, {'template_name': 'static/search_site.html'}, name='search_site'),
    path('search/', search, name='search'),
    path('login/', login, name='login'),
    path('settings/', user_settings, name='settings'),
    path('logout/', LogoutView.as_view(), {'next_page': '/'}, name='logout'),
    path('promo/', render, {'template_name': 'static/promo.html'}),
    path('about/', render, {'template_name': 'static/about.html'}),
    path('sitemap/', render, {'template_name': 'static/sitemap.html'}),
    path('robots.txt', rules_list, name='robots_rule_list'),
    path('%s/' % settings.TELEGRAM_BOT_URL, telebot),
    path('%s/' % settings.ADMIN_URL, admin.site.urls),
]

urlpatterns += get_sitegate_urls()  # Цепляем URLы от sitegate,
urlpatterns += get_sitemessage_urls()  # Цепляем URLы от sitemessage,

# Используем собственные страницы ошибок.
handler403 = permission_denied
handler404 = page_not_found
handler500 = server_error
開發者ID:idlesign,項目名稱:pythonz,代碼行數:31,代碼來源:urls.py

示例7: url

from django.views.generic.base import TemplateView
from django.conf.urls import url, include
from django_registration.views import RegistrationView
from django.contrib.auth import views as auth_views
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import reverse_lazy
from sweettooth.auth import views, forms

urlpatterns = [
    url(r'^login/', LoginView.as_view(form_class=forms.AuthenticationForm), name='auth-login'),

    url(r'^change_display_name/(?P<pk>\d+)', views.ajax_change_display_name),

    url(r'^logout/', LogoutView.as_view(next_page='/'), name='auth-logout'),

    url(r'^register/$', RegistrationView.as_view(form_class=forms.AutoFocusRegistrationForm),
        name='registration_register'),

    url(r'settings/(?P<user>.+)', TemplateView.as_view(template_name='profile/settings.html'),
        name='auth-settings'),

    url(r'', include('django_registration.backends.activation.urls')),
    url(r'^profile/(?P<user>.+)', views.profile, name='auth-profile'),
    url(r'^profile/', views.profile_redirect, name='auth-profile'),

    url(r'^login/$',
        auth_views.LoginView.as_view(),
        name='auth-login'),
    url(r'^logout/$',
        auth_views.LogoutView.as_view(),
開發者ID:GNOME,項目名稱:extensions-web,代碼行數:30,代碼來源:urls.py

示例8: url

from django.conf.urls import url
from django.contrib.auth.views import LoginView, LogoutView

from .views import RegisterView


urlpatterns = [
    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^login/$', LoginView.as_view(template_name='account/login.html'), name="login"),
    url(r'^logout/$', LogoutView.as_view(template_name='account/login.html'), name="logout"),
]
開發者ID:osama-mohamed,項目名稱:Blog_django_restful_api,代碼行數:11,代碼來源:urls.py

示例9:

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import base64
import logging

from django.conf import settings
from django.contrib import auth
from django.contrib.auth.decorators import login_required
try:
    from django.contrib.auth.views import LogoutView
    django_logout = LogoutView.as_view()
except ImportError:
    from django.contrib.auth.views import logout as django_logout
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from django.http import Http404, HttpResponse
from django.http import HttpResponseRedirect  # 30x
from django.http import HttpResponseBadRequest  # 40x
from django.http import HttpResponseServerError  # 50x
from django.views.decorators.http import require_POST
from django.shortcuts import render
from django.template import TemplateDoesNotExist
from django.utils.six import text_type, binary_type, PY3
from django.views.decorators.csrf import csrf_exempt

from saml2 import BINDING_HTTP_REDIRECT, BINDING_HTTP_POST
from saml2.metadata import entity_descriptor
開發者ID:knaperek,項目名稱:djangosaml2,代碼行數:31,代碼來源:views.py

示例10: path

from django.conf import settings
from django.contrib import admin
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import include, path
from django.views.generic import RedirectView
from ibms.views import SiteHomeView, HealthCheckView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('login/', LoginView.as_view(template_name='login.html'), name='login'),
    path('logout/', LogoutView.as_view(template_name='logged_out.html'), name='logout'),
    path('confluence/', RedirectView.as_view(url=settings.HELP_URL), name='help_page'),
    path('healthcheck/', HealthCheckView.as_view(), name='health_check'),
    path('', include('ibms.urls')),
    path('', include('sfm.urls')),
    path('', SiteHomeView.as_view(), name='site_home'),
]
開發者ID:wilsonc86,項目名稱:ibms,代碼行數:17,代碼來源:urls.py

示例11: url

from django.conf.urls            import include, url
from django.http                 import HttpResponse
from django.views.generic        import TemplateView
from django.conf                 import settings
from django.conf.urls.static     import static

from django.contrib.auth.views   import LoginView, LogoutView

urlpatterns = [
	url(r'', include('manager.urls')),
	url(r'^login/$', LoginView.as_view(template_name='login.html'), name='login'),
	url(r'^logout/$', LogoutView.as_view(template_name='logout.html'), name='logout'),
	url(r'^robots.txt', lambda x: HttpResponse('User-Agent: *\nDisallow: /', content_type='text/plain'), name='robots_file'),
]

if settings.LOCAL_DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

handler403 = lambda r: url(r, TemplateView.as_view(template_name='403.html'))
handler404 = lambda r: url(r, TemplateView.as_view(template_name='404.html'))
handler500 = lambda r: url(r, TemplateView.as_view(template_name='500.html'))
開發者ID:UCF,項目名稱:PostMaster,代碼行數:21,代碼來源:urls.py

示例12: get_patterns

def get_patterns(user_model):
    # Registration urls
    return [
        path(
            settings.LOGIN_URL.lstrip('/'),
            LoginView.as_view(**dict(
                template_name='users/login.html',
                authentication_form=AuthenticationForm,
                extra_context=dict(
                    password_reset_url=reverse_lazy('users-password_reset'),
                    login_url=settings.LOGIN_URL,
                    next=settings.LOGIN_REDIRECT_URL,
                    login_view=True
                )
            )),
            name='users-login'
        ),
        path(
            'users/logout/',
            LogoutView.as_view(**dict(
                template_name='users/logged_out.html',
                next_page=settings.LOGOUT_REDIRECT_URL
            )),
            name='users-logout'
        ),
        # account confirmation url, protected by secret token; displayed when the users clicked the account confirm url
        # in its account confirmation email
        re_path(
            r'^users/account_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
            account_confirm, dict(
                template_name='users/account_confirm.html',
                set_password_form=AccountActivationPasswordForm,
                post_reset_redirect='/users/account_confirm_complete/',
                user_model=user_model
            ),
            name='users-account_confirm'
        ),
        # indicated that the account was successfully confirmed
        path(
            'users/account_confirm_complete/',
            TemplateView.as_view(
                template_name='users/account_confirm_complete.html',
                extra_context=dict(
                    login_redirect_url=settings.LOGIN_REDIRECT_URL,
                    login_url=settings.LOGIN_URL,
                    user_model=user_model
                )
            ),
            name='users-account_confirm_complete'
        ),

        # displays a form that takes a user's email address; when submitted, an email with a password reset url is sent
        # to that user
        path(
            'users/password_reset/',
            PasswordResetView.as_view(**dict(
                template_name='users/password_reset.html',
                success_url=reverse_lazy('users-password-reset-done'),
                email_template_name='users/email/password_reset.html',
                form_class=get_password_reset_form('users-password_reset_confirm', user_model),
            )),
            name='users-password_reset'
        ),
        # displays that the password change email has been sent.
        path(
            'users/password_reset_done/',
            PasswordResetDoneView.as_view(**dict(
                template_name='users/password_reset_done.html',
                extra_context=dict(login_url=settings.LOGIN_URL),
            )),
            name='users-password-reset-done'
        ),
        # displays the form where the user can choose its new password
        re_path(
            r'^users/password_reset_confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
            PasswordResetConfirmView.as_view(**dict(
                template_name='users/password_reset_confirm.html',
                success_url=reverse_lazy('user-password_reset_complete'),
            )),
            name='users-password_reset_confirm'
        ),
        # indicates that the user's password has been successfully changed.
        path(
            'users/password_reset_complete/',
            PasswordResetCompleteView.as_view(**dict(
                template_name='users/password_reset_complete.html',
                extra_context=dict(login_url=settings.LOGIN_URL)
            )),
            name='user-password_reset_complete'
        )
    ]
開發者ID:dodo1708,項目名稱:djpl-users,代碼行數:91,代碼來源:authurls.py

示例13: url

from django.conf.urls import include, url
from django.contrib.auth.views import LoginView, LogoutView

from django.contrib import admin
admin.autodiscover()

admin.site.site_header = "WLNet DataView Administrator"
admin.site.site_title = "WLNet DataView"

from portal.views import index
from dataview.views import v1_config

urlpatterns = [
    url(r'^$', index, name='index'),
    url(r'^api/1/config$', v1_config, name='v1_config'),
    url(r'^api/', include('api.urls')),

    #url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', admin.site.urls),
    
    url(r'^account/login/$', LoginView.as_view(template_name='registration/login.html')),
    url(r'^account/logout/$', LogoutView.as_view()),

    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),

]
開發者ID:wl-net,項目名稱:dataview,代碼行數:26,代碼來源:urls.py

示例14: path

from django.urls import path, include
from django.contrib.auth.views import LogoutView
from django.conf import settings
from . import api
from . import views

apipattens = [
    path('check_token/', api.CheckToken.as_view(), name='check_token'),
    path('change_email/', api.ChangeEmail.as_view(), name='change_email'),
    path('change_token/', api.ChangeToken.as_view(), name='change_token'),
    path('reset_token_email/', api.ResetTokenEmail.as_view(), name='reset_token_email'),
    path('list_profiles/', api.ListProfiles.as_view(), name='list_profiles'),
    path('list_hacker_profiles/', api.ListHackerProfiles.as_view(), name='list_hacker_profiles'),
    path('sui_list_profiles/', api.SUIListProfiles.as_view(), name='sui_list_profiles'),
]

app_name = 'profile'
urlpatterns = [
    path('api/', include((apipattens, 'api')), name='api'),
    path('logout/', LogoutView.as_view(next_page=settings.LOGIN_URL), name='logout'),
    path('token_login/<str:token>/', views.TokenLoginView.as_view(), name='token_login'),
    path('verify_email/<str:code>/', views.VerifyEmailView.as_view(), name='verify_email'),
]
開發者ID:TalentoUnicamp,項目名稱:my,代碼行數:23,代碼來源:urls.py

示例15: path

    ),
    path(
        "dashboard/requests/employees/<int:request_pk>/reject/",
        views.RejectEmployeeRequest.as_view(),
        name="reject-employee-request",
    ),
    path(
        "dashboard/requests/employees/<int:request_pk>/",
        views.DetailEmployeeRequest.as_view(),
        name="detail-employee-request",
    ),
    path(
        "dashboard/requests/contractors/<int:request_pk>/approve/",
        views.ApproveContractorRequest.as_view(),
        name="approve-contractor-request",
    ),
    path(
        "dashboard/requests/contractors/<int:request_pk>/reject/",
        views.RejectContractorRequest.as_view(),
        name="reject-contractor-request",
    ),
    path(
        "dashboard/requests/contractors/<int:request_pk>/",
        views.DetailContractorRequest.as_view(),
        name="detail-contractor-request",
    ),
    path("admin/", admin.site.urls),
    path("login", LoginView.as_view(), name="login"),
    path("logout", LogoutView.as_view(), name="logout"),
]
開發者ID:jteppinette,項目名稱:amp,代碼行數:30,代碼來源:urls.py


注:本文中的django.contrib.auth.views.LogoutView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。