Пример #1
0
from django.conf.urls import url
from . import views
from apps.user.views import (
    RegisterView,
    ActiveView,
    LoginView,
    LogoutView,
    UserInfoView,
    UserOrderView,
    UserSiteView,
)
from django.contrib.auth.decorators import login_required

urlpatterns = [
    url(r'^register$', RegisterView.as_view(), name='register'),  # 用户注册
    url(r'^index$', views.index, name='index'),  # 用于测试
    url(r'^active/(?P<token>.*)$', ActiveView.as_view(),
        name='active'),  # 用户激活
    url(r'^login$', LoginView.as_view(), name='login'),  # 用户登录
    url(r'^$', login_required(UserInfoView.as_view()),
        name='user'),  # 用户中心信息页面
    url(r'^order/(?P<page>\d+)$',
        login_required(UserOrderView.as_view()),
        name='order'),  # 用户订单信息页面
    url(r'^address$', login_required(UserSiteView.as_view()),
        name='address'),  # 用户地址详情页面
    url(r'^logout$', LogoutView.as_view(), name='logout'),  # 用户退出登录
]
Пример #2
0
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from apps.user.views import RegisterView, ActiveView, LoginView, UserInfoView, UserOrderView, UserSiteView, LogoutView

urlpatterns = [
    url(r'^register$', RegisterView.as_view(), name='register'),  # 注册
    url(r'^active/(?P<token>.*)$', ActiveView.as_view(), name='active'),  # 激活
    url(r'^login$', LoginView.as_view(), name='login'),  # 登录

    # url(r'^order$', login_required(UserOrderView.as_view()), name='order'),  # 用户中心-订单页
    # url(r'^address$', login_required(UserSiteView.as_view()), name='address'),  # 用户中心-地址页
    # url(r'^$', login_required(UserInfoView.as_view()), name='info'),  # 用户中心-信息页
    url(r'^order/(?P<page>\d+)$', UserOrderView.as_view(),
        name='order'),  # 用户中心-订单页
    url(r'^address$', UserSiteView.as_view(), name='address'),  # 用户中心-地址页
    url(r'^$', UserInfoView.as_view(), name='info'),  # 用户中心-信息页
    url(r'^logout$', LogoutView.as_view(), name='logout'),  # 用户中心-信息页
]
Пример #3
0
from django.contrib.auth.decorators import login_required
from django.urls import path, re_path
from apps.user.views import RegisterView, LoginView, UserInfoView, UserOrderView, UserSiteView, LogoutView

# from apps.user import views

app_name = 'user'
urlpatterns = [
    # path('register/', views.register, name='register'),
    # path('register_handle', views.register_handle, name='register_handle'),
    path('register', RegisterView.as_view(), name='register'),  # 注册
    #re_path('active/(?P<token>.*)', ActiveView.as_view(), name='active'),  # 用户激活
    path('login', LoginView.as_view(), name='login'),  # 登录
    path('logout', LogoutView.as_view(), name='logout'),  # 退出登录
    path('', login_required(UserInfoView.as_view()), name='user'),  # 用户信息
    path('order/', login_required(UserOrderView.as_view()),
         name='order'),  # 订单
    path('address/', login_required(UserSiteView.as_view()),
         name='address'),  # 地址

    # 使用LoginRequiredMixin装饰器
    path('', UserInfoView.as_view(), name='user'),  # 用户信息
    re_path('^order/(?P<page>\d+)$', UserOrderView.as_view(),
            name='order'),  # 订单
    path('address/', UserSiteView.as_view(), name='address'),  # 地址
]
Пример #4
0
from django.contrib.auth.decorators import login_required
from django.urls import path, re_path
from apps.user.views import RegisterView, ActiveView, LoginView, UserInfoView, UserOrderView, UserSiteView, LogoutView

# from apps.user import views

app_name = 'user'
urlpatterns = [
    # path('register/', views.register, name='register'),
    # path('register_handle', views.register_handle, name='register_handle'),
    path('register', RegisterView.as_view(), name='register'),  # 注册
    re_path('active/(?P<token>.*)', ActiveView.as_view(),
            name='active'),  # 用户激活
    path('login', LoginView.as_view(), name='login'),  # 登录
    path('logout', LogoutView.as_view(), name='logout'),  # 退出登录

    # path('', login_required(UserInfoView.as_view()), name='user'),  # 用户信息
    # path('order/', login_required(UserOrderView.as_view()), name='order'),  # 订单
    # path('address/', login_required(UserSiteView.as_view()), name='address'),  # 地址

    # 使用LoginRequiredMixin装饰器
    path('', UserInfoView.as_view(), name='user'),  # 用户信息
    re_path('^order/(?P<page>\d+)$', UserOrderView.as_view(),
            name='order'),  # 订单
    path('address/', UserSiteView.as_view(), name='address'),  # 地址
]
Пример #5
0
from django.urls import path, re_path
from apps.user.views import RegisterView, LoginView, UserInfoView, UserOrderView, UserSiteView, LogOutView
from django.conf.urls import include, url

urlpatterns = [
    url(r'^login$', LoginView.as_view(), name="login"),
    url(r'^register$', RegisterView.as_view(), name="register"),
    url(r'^info$', UserInfoView.as_view(), name="info"),
    url(r'^order/(?P<page>\d+)$', UserOrderView.as_view(), name="order"),
    url(r'^site$', UserSiteView.as_view(), name="site"),
    url(r'^logout$', LogOutView.as_view(), name="logout"),
]