诚意
诚意如你,当一诚的态度对待

导航

 

一:获取url路径

类似url:  http://127.0.0.1:8001/customer_edit/2?next=/customer_list/

1:如何获取整个url:

  前端获取方法:location.href========http://127.0.0.1:8001/customer_edit/2?next=/customer_list/

 

2:如何获取url参数:

  前端获取方法:location.search====?next=/customer_list/

  那么如何获取next后面的路径:location.search.slice(6)

 

二:Django项目中文件访问顺序

setting.py定义的如静态文件目录。Django先是从全局中查找,如果找不到。然后再从各个应用中查找,安装setting.py定义的中间件的顺序

 

 

 

三:如何获取类名(字符串形式)

 

    from school.models import Student

    print(Student._meta.model_name)  #student  类名
    print(Student._meta.app_label)  #school  应用名字

 

posted on 2018-11-12 15:51  诚意  阅读(69)  评论(0编辑  收藏  举报