- 博客(5)
- 收藏
- 关注
原创 Django表单post请求
urls.py re_path(’^search_post$’, search.search_post), post.html 文件代码: {% csrf_token %} <p>{{ rlt }}</p> search2.py 文件代码: -- coding: utf-8 -- from djang...
2020-02-02 21:24:17 117
原创 Django表单get请求
创建一个 search.py 文件 -- coding: utf-8 -- from django.http import HttpResponse from django.shortcuts import render_to_response #使用 render_to_response可能会出错,可使用render #from django.shortcuts import render 表单...
2020-02-02 21:21:25 280
原创 Django数据库增删改查操作
-- coding: utf-8 -- from django.http import HttpResponse #调用Test模型类 from TestModel.models import Test def testdb(request): #数据库查询 获得所有数据行,相当于SQL中的SELECT * FROM result=Test.objects.all() filter相当于SQL中的...
2020-02-02 20:50:18 129
原创 Django 模板标签
f/else 标签 {% if condition1 %} … display 1 {% elif condition2 %} … display 2 {% else %} … display 3 {% endif %} for 标签 {% for athlete in athlete_list %} {{ athlete.name }} {% endfor %} ifequal/if...
2020-02-02 20:22:23 87 1
原创 Django安装
一、安装:pip install Django==3.0.2 二、pycharm创建项目 manage.py: 一个实用的命令行工具,可让你以各种方式与该 Django 项目进行交互。 …/init.py: 一个空文件,告诉 Python 该目录是一个 Python 包。 …/settings.py: 该 Django 项目的设置/配置。 …/urls.py: 该 Django 项目的 URL 声...
2020-02-02 20:20:44 87
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人