上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 32 下一页
2023年8月17日
摘要: 创建模型 from django.db import models #学生类 class Student(models.Model): id = models.AutoField(primary_key=True) sname = models.CharField(max_length=20) # 阅读全文
posted @ 2023-08-17 11:46 boye169 阅读(104) 评论(0) 推荐(0)
2023年8月16日
摘要: __import__() 函数用于动态加载类和函数 。 如果一个模块经常变化就可以使用 __import__() 来动态载入。 语法 __import__ 语法: __import__(name[, globals[, locals[, fromlist[, level]]]]) 参数说明: nam 阅读全文
posted @ 2023-08-16 16:57 boye169 阅读(194) 评论(0) 推荐(0)
2023年8月9日
摘要: from django.contrib.auth.models import User from django.db.models import Q from django.db.models.functions import Lower from app.models import * 添加操作a 阅读全文
posted @ 2023-08-09 15:53 boye169 阅读(27) 评论(0) 推荐(0)
摘要: ORM简介 O(objects):类和对象。R(Relation):关系,关系数据库中的表格。M(Mapping):映射。 Django ORM框架的功能: 建立模型类和表之间的对应关系,允许我们通过面向对象的方式来操作数据库。 根据设计的模型类生成数据库中的表格。 通过方便的配置就可以进行数据库的 阅读全文
posted @ 2023-08-09 15:50 boye169 阅读(135) 评论(0) 推荐(0)
摘要: 模板继承 模板继承和类的继承含义是一样的,主要是为了提高代码重用,减轻开发人员的工作量 {% extends 'base.html' %} base.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title> 阅读全文
posted @ 2023-08-09 15:19 boye169 阅读(24) 评论(0) 推荐(0)
摘要: from django.template import Template,Context,loader def index(context): temp = loader.get_template("table.html") return temp.render(context) def gette 阅读全文
posted @ 2023-08-09 15:01 boye169 阅读(20) 评论(0) 推荐(0)
摘要: from django.forms.models import model_to_dict Group.objects.get(id=1).__dict__ model_to_dict(Group.objects.get(id=1)) User.objects.get(id=2).to_dict() 阅读全文
posted @ 2023-08-09 14:42 boye169 阅读(55) 评论(0) 推荐(0)
摘要: https://docs.djangoproject.com/zh-hans/3.1/howto/custom-template-tags/ 代码布局 自定义的 tags 和 filters 会保存在模块名为 templatetags 的目录内。模块文件的名字即稍候你用来加载 tags 的名字,所以 阅读全文
posted @ 2023-08-09 14:28 boye169 阅读(32) 评论(0) 推荐(0)
2023年8月7日
摘要: Scapy方式 Scapy是一个强大的Python库,可用于创建、发送和解码网络数据包。它能够抓取和处理各种网络层协议、载荷和报头信息。 Scapy是一个全能的库,包含各种工具和功能。该库具有灵活性、可扩展性和实用性 from scapy.all import * pkts = sniff(ifac 阅读全文
posted @ 2023-08-07 11:17 boye169 阅读(443) 评论(0) 推荐(0)
2023年8月4日
摘要: 概述 // 立刻执行函数 (function($){ // code })(jQuery); 参数说明 形参: $ 实参: jQuery 闭包的作用 避免全局依赖 避免第三方破坏 兼容jQuery操作符'$'和jQuery; /*comment.js*/ ;(function($){ //消息显示 阅读全文
posted @ 2023-08-04 14:47 boye169 阅读(69) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 32 下一页