会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Mr.zang's Blog
写代码让人快乐,让人放松
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
···
9
下一页
2023年5月23日
Let’s Encrypted:一键申请SSL证书脚本
摘要: wget https://raw.githubusercontent.com/nanqinlang-script/acme/master/acme_2.0.sh bash acme_2.0.sh 使用说明 输入你的域名 选择要生成证书的类型。输入数字 0(生成 RSA 类型) 或 1(生成 ECC
阅读全文
posted @ 2023-05-23 14:00 super_ip
阅读(2632)
评论(0)
推荐(0)
2023年5月22日
数量统计aggregate
摘要: 比如统计某个会员有多少条留言? def follow_num(self): num=Guestbook.objects.filter(user=self.pk,status=True).aggregate(c=Count('user__membername')) return num['c']
阅读全文
posted @ 2023-05-22 13:51 super_ip
阅读(29)
评论(0)
推荐(0)
2023年5月16日
DRF学习第一课
摘要: 1.安装drf pip3 install djangorestframework -i https://pypi.douban.com/simple 2.在settings.py的INSTALLED_APPS中添加’rest_framework’。 INSTALLED_APPS = [ ... 'r
阅读全文
posted @ 2023-05-16 21:08 super_ip
阅读(46)
评论(0)
推荐(0)
2023年5月5日
vue3学习第一课
摘要: 1,先安装npm brew install npm npm init vite-app vue3demmo cd vue3demmo npm install npm run dev
阅读全文
posted @ 2023-05-05 12:44 super_ip
阅读(27)
评论(0)
推荐(0)
djangoadmin后台搜索结果筛选自定义模版
摘要: django-admin对搜索结果进行自定义统计,可参考代码如下: def changelist_view(self, request, extra_context=None): #cur1_time = datetime.now() data_dict = {} value = request.G
阅读全文
posted @ 2023-05-05 09:16 super_ip
阅读(187)
评论(0)
推荐(0)
2023年4月29日
djangoadmin中2个字段连接 姓名组合fullname
摘要: def full_name(self): return (self.last_name+self.first_name) def __str__(self): return self.full_name()
阅读全文
posted @ 2023-04-29 22:31 super_ip
阅读(47)
评论(0)
推荐(0)
2023年4月28日
搜索的bool值和filter中的bool进行比较筛选数据
摘要: def true(value) -> bool: return value in ('True', 'true', 'TRUE', True, 1) condition: bool = true(request.GET.get('请求里的字段')) YourModel.objects.filter(
阅读全文
posted @ 2023-04-28 15:41 super_ip
阅读(48)
评论(0)
推荐(0)
2023年4月25日
django admin 中对自定义字段进行搜索
摘要: 我想在 django admin 中使用investment字段进行搜索,但总是得到Cannot resolve keyword 'investment' into field.选项是 Model 字段。 有什么方法可以使用investment字段进行搜索? from django.db.model
阅读全文
posted @ 2023-04-25 21:53 super_ip
阅读(72)
评论(0)
推荐(0)
2023年4月24日
django admin 根据用户显示不同的列表以及编辑界面
摘要: 根据用户判断权限,显示不同的界面。 class MyModelAdmin(admin.ModelAdmin) def changelist_view(self, request, extra_context=None): user = request.user if user.is_superuse
阅读全文
posted @ 2023-04-24 16:44 super_ip
阅读(66)
评论(0)
推荐(0)
python判断一个字符是否是半角
摘要: def is_halfwidth(char): """ 判断一个字符是否是半角 """ if len(char) != len(char.encode()): return False else: return True
阅读全文
posted @ 2023-04-24 14:28 super_ip
阅读(99)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
···
9
下一页
公告