from django.contrib.admin.views.decorators import staff_member_required from news.views import NewsDetailView, NewsListView from user.views import UserDetailView, UserSignup, UserLogin, StaffListView, UserLogout from main.views import ContactView, MainView from api.views import GetNews urlpatterns = [ # Examples: # url(r'^$', 'EnerWat.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^$', MainView.as_view(), name='home'), url(r'contact/?', ContactView.as_view(), name='contact'), # User views url(r'^signup/?', staff_member_required(UserSignup.as_view(), login_url='user_login'), name='user_signup'), url(r'^login/?', UserLogin.as_view(), name='user_login'), url(r'^staff/?', StaffListView.as_view(), name='user_staff'), url(r'^logout/?', UserLogout.as_view(), name='user_logout'), url(r'^profile/?', login_required(UserDetailView.as_view()), name='user_detail'), # API views url(r'^api/get-news/(?P<news_id>\d+)', GetNews.as_view(), name='api_get_news'), # News views url(r'^news/(?P<pk>\d+)', NewsDetailView.as_view(), name='news_detail'), url(r'^news/?$', NewsListView.as_view(), name='news_list'), ]
from django.urls import path from user.views import Register, Profile, UserLogin urlpatterns = [ path('register/', Register.as_view()), path('manage/', Profile.as_view()), path('login/', UserLogin.as_view()), ]
from django.conf.urls import url from user.views import RegisterView, user_active, UserLogin, UserInfoView, UserSiteView, UserOrderView, UserLogoutView urlpatterns = [ url(r'^register$', RegisterView.as_view(), name='register'), url(r'^active/(?P<token>.*)$', user_active, name='user_active'), url(r'^login$', UserLogin.as_view(), name='login'), url(r'logout$', UserLogoutView.as_view(), name='logout'), url(r'^info$', UserInfoView.as_view(), name='user_info'), url(r'^order$', UserOrderView.as_view(), name='order'), url(r'^site$', UserSiteView.as_view(), name='site') ]
from django.urls import path from user.views import CreateUserView, CreateTokenView, \ UserLogin app_name = 'user' urlpatterns = [ path('signup/', CreateUserView.as_view(), name='create'), path('token/', CreateTokenView.as_view(), name='token'), path('login/', UserLogin.as_view(), name='login'), ]
from django.urls import path from django.conf.urls import url from user.views import UserLogin, LogoutView urlpatterns = [ url('^login/', UserLogin.as_view(), name='login'), url('^logout/$', LogoutView.as_view(), name='logout'), ]
from django.urls import path from user.views import UserListCreateAPIView, UserLogin, ChangePassword urlpatterns = [ path('', UserListCreateAPIView.as_view(), name='user-list-create-api'), path('login', UserLogin.as_view(), name='user-login-api'), path('change-password', ChangePassword.as_view(), name='user-change-password-api'), ]
from django.urls import path from user.views import ( UserInfo, UserPwd, UserMenu, user_operation_log, UserLogin, user_logout, ) urlpatterns = [ path('', UserInfo.as_view()), path('info/', UserInfo.as_view()), path('pwd/', UserPwd.as_view()), path('menu/', UserMenu.as_view()), path('menu/<int:index>/', UserMenu.as_view()), path('log/', user_operation_log), path('log/<int:index>/', user_operation_log), path('login/', UserLogin.as_view(), name="login"), path('logout/', user_logout, name="logout"), ]