def test_login_view(self): request = create_request(is_post=False, url='', is_anonymous=False) response = LoginView.as_view()(request) assert response.status_code == 302, "Should have redirected" request = create_request(is_post=False, url='/login/', is_anonymous=True) response = LoginView.as_view()(request) assert response.status_code == 200, "Error" data = { 'email': "*****@*****.**", 'password': "******", } request = create_request(is_post=True, url='/login/', is_anonymous=False, data=data) response = LoginView.as_view()(request) assert response.status_code == 302, "Error"
from django.conf.urls import patterns, include, url from django.contrib import admin from django.conf import settings from djgeojson.views import GeoJSONLayerView from reports.models import Entry, Report from home.views import HomePageView, SignUpView, LoginView, LogOutView, PortalView from django.contrib.auth.decorators import login_required, permission_required urlpatterns = patterns( "", # Examples: # url(r'^$', 'mrtagis.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r"^$", HomePageView.as_view(), name="home"), url(r"^p/$", login_required(PortalView.as_view()), name="portal"), # url(r'^p/$', PortalView.as_view(),name='portal'), url(r"^accounts/register/$", SignUpView.as_view(), name="signup"), url(r"^accounts/login/$", LoginView.as_view(), name="login"), url(r"^accounts/logout/$", LogOutView.as_view(), name="logout"), # url(r'p/?P<portal>/$', HomePageView.as_view(), name ='portal'), url(r"^admin/", include(admin.site.urls)), url(r"^signups/", include("signups.urls")), url(r"^reports/", include("reports.urls", namespace="reports")), url(r"^media/(?P<path>.*)$", "django.views.static.serve", {"document_root": settings.MEDIA_ROOT}), url(r"^language/(?P<language>[a-zA-Z\-]+)/$", "reports.views.language"), url(r"^data.geojson$", GeoJSONLayerView.as_view(model=Report), name="data"), url(r"^p/save_marker/$", "home.views.save_marker", name="save_marker"), url(r"^p/remove_marker/$", "home.views.remove_marker", name="remove_marker"), )
from django.urls import path from home.views import HomeView, LoginView, LoginApiView from settings.views import MenuApiView, MenuView urlpatterns = [ path('', HomeView.as_view()), path('login', LoginView.as_view()), path('settings/menu', MenuView.as_view()), # api path('api/login', LoginApiView.as_view()), path('api/menus', MenuApiView.as_view()) ]
from django.conf.urls import patterns, url from home.views import HomeView, LoggedInView, LoginView, LogoutView, IconsView urlpatterns = patterns('', url(r'^$', HomeView.as_view()), url(r'^logged-in/', LoggedInView.as_view()), url(r'^login/', LoginView.as_view()), url(r'^logout/', LogoutView.as_view()), url(r'^icons/', IconsView.as_view()), )
from django.urls import path, include from home.views import HomeView, LogoutView, LoginView, TermsOfServiceView, PrivacyView urlpatterns = [ path('', HomeView.as_view(), name='home'), path('logout/', LogoutView.as_view(), name='logout'), path('login/', LoginView.as_view(), name='login'), path('terminos/', TermsOfServiceView.as_view(), name='ToS'), path('privacidad/', PrivacyView.as_view(), name='Privacy'), ]
from django.conf.urls.defaults import patterns, include, url from django.contrib.auth.decorators import login_required from home.views import ( PromoView, RegisterView, LoginView, LogoutView, MyVirtMoneyView, RegistrationCompleteView, EmailConfirmedView, ) from home.authviews import AuthVkView, AuthFbView from shops.views import ListMyView from django.views.generic import RedirectView urlpatterns = patterns( "", url(r"^auth/vk", AuthVkView.as_view()), url(r"^auth/fb", AuthFbView.as_view()), url(r"^my-virt-money", login_required(MyVirtMoneyView.as_view())), url(r"^register/$", RegisterView.as_view()), (r"^register/$", RedirectView.as_view(url="/welcome/")), url(r"^$", PromoView.as_view()), url(r"^welcome", PromoView.as_view()), url(r"^login/$", LoginView.as_view()), url(r"^logout/$", LogoutView.as_view()), url(r"^registration-complete/", login_required(RegistrationCompleteView.as_view())), url(r"^email-confirmed/", login_required(EmailConfirmedView.as_view())), url(r"^shops-list-my", login_required(ListMyView.as_view())), )
from django.conf.urls import patterns, url from home.views import HomeView, LoggedInView, LoginView, LogoutView, IconsView urlpatterns = patterns( '', url(r'^$', HomeView.as_view()), url(r'^logged-in/', LoggedInView.as_view()), url(r'^login/', LoginView.as_view()), url(r'^logout/', LogoutView.as_view()), url(r'^icons/', IconsView.as_view()), )