一:获取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 应用名字