zoukankan      html  css  js  c++  java
  • 5.反生成url

    # url(r"^all/(?P<article_type_id>\d+)$", home.index,name="index" ),
        # 在html中 {% url "index" article_type_id=1 %}  =>all/1/
        # 在view中:reverse("index",kwargs={"article_type_id":}) =>all/1/
        # url(r"^all/\d+$", home.index,name="index" )
        # 在html中 {% url "index" 1 %}  =>all/1/
        # 在view中:reverse("index",args=(1,)) =>all/1/
    # 关于form表单组件中的在html页面上获取所有的错误信息
    {{v.no_filed_errors}}
    
    
     1 from django.conf.urls import url, include
     2 
     3 from common.routers import StandardRouter
     4 from .viewsets import UserCheckViewSet, UserRegisterViewSet, UserLoginViewSet, UserLogoutViewSet, \
     5     UserProfileViewSet, UserResetPasswordViewSet, UserChangePasswordViewSet, UserChangeEmailViewSet, \
     6     UserChangePhoneViewSet
     7 
     8 router = StandardRouter()
     9 
    10 # 用户注册
    11 router.register('register', UserRegisterViewSet, base_name='register')   # 这种生成方式时使用router
    12 # 用户登录
    13 router.register('login', UserLoginViewSet, base_name='login')
    14 # 重设密码
    15 router.register('reset_password', UserResetPasswordViewSet, base_name='reset_password')
    16 
    17 urlpatterns = [
    18     # 检查用户是否存在 通过邮箱或者手机号
    19     url(r'^check/?$', UserCheckViewSet.as_view(    # 另一种生成url方式如下,可以使用as_view方法,表明方式actions
    20         actions=(
    21             {'get': 'retrieve'}
    22         )
    23     )),
    24     # 用户登出
    25     url(r'^logout/?$', UserLogoutViewSet.as_view(
    26         actions=(
    27             {'get': 'retrieve'}
    28         )
    29     )),
    30     # 用户详情
    31     url(r'^profile/?$', UserProfileViewSet.as_view(
    32         actions=({'get': 'retrieve', 'put': 'update'})
    33     )),
    34     # 修改密码
    35     url(r'^change_password/?$', UserChangePasswordViewSet.as_view(
    36         actions=({'put': 'update'})
    37     )),
    38     # 绑定/修改邮箱
    39     url(r'^change_email/?$', UserChangeEmailViewSet.as_view(
    40         actions=({'put': 'update'})
    41     )),
    42     # 绑定/修改手机号
    43     url(r'^change_phone/?$', UserChangePhoneViewSet.as_view(
    44         actions=({'put': 'update'})
    45     )),
    46     # 注册 router,这一行必须放最后
    47     url(r'', include(router.urls)),
    48 ]

     

  • 相关阅读:
    VPS CenteOS Linux 上传 下载文件(Apache配置、SSH)
    tar命令加密压缩
    操作系统命令技巧备忘录
    网络流量分析-PCAP切割、筛选、合并
    【Shell】30分钟关闭Tcpdump,开启Tcpdump、检测目录大小终止任务
    大数据做安全的网站
    WinRAR代码执行漏洞CVE-2018-20250
    Linux嗅探ettercap
    WindowsPE权威指南-PE文件头中的重定位表
    推荐书籍-恶意软件分析诀窍与工具箱
  • 原文地址:https://www.cnblogs.com/liuzhanghao/p/11041640.html
Copyright © 2011-2022 走看看