V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  wingor2015  ›  全部回复第 4 页 / 共 5 页
回复总数  83
1  2  3  4  5  
2022-04-26 17:54:35 +08:00
回复了 maloneleo88 创建的主题 Python django models 自定义方法报错,我这哪里写的有问题?
dicc 的意见非常重要,自己定义 id 没有这么简单,但是如果你一定要这么做呢,也能实现

chioce_id 这个方法应该放到 class Detect 定义的外面,才能正确找到,但是放到外面就无法获取到 objects.count (不要用 all 再 len )
要实现的这个逻辑的话,你可以放到 save 方法里
detect_id = models.BigIntegerField(verbose_name='编号',default=None)

def save(self, *args, **kwargs):
if not self. detect_id:
self. detect_id = self.__class__.objects.count() + 1
super(Detect, self).save(*args, **kwargs)
包给楼上的 cominghome
2022-03-15 15:56:57 +08:00
回复了 wingor2015 创建的主题 MySQL mysql 有啥简单易用的高可用方案?
@Achilless @johopig @iyaozhen @ToBeHacker 谢谢各位,根据各位的意见,准备就搞个 proxy+主从
2022-03-15 15:55:53 +08:00
回复了 wingor2015 创建的主题 MySQL mysql 有啥简单易用的高可用方案?
@westoy 内网环境上不了云😷
2022-02-10 17:45:21 +08:00
回复了 laravel 创建的主题 程序员 手上有个特别好用的即时通讯系统,支持集群
特别好是个什么好法?
用 pdfminer 提取过 PDF ,但是效果有些好有些差,pdf 是不能保障文件里的内容都能被正确提起出来的
2021-12-07 14:38:42 +08:00
回复了 lagoon 创建的主题 程序员 邪恶的算法,有多少责任在程序员?
有没有责任跟警察叔叔说吧,看看互联网公司全锅端的时候判决书就知道了
2021-04-28 10:47:16 +08:00
回复了 shyrock 创建的主题 Python logging 模块偶尔丢日志
有多个进程操作这个日志文件吗?
2020-05-20 12:50:02 +08:00
回复了 cuixiao603 创建的主题 Python crontab 运行 flask 的一个 app 总是执行不成功
supervisior 比 crontab 不知道高到哪里去了
2020-05-20 12:36:13 +08:00
回复了 songdg 创建的主题 Python 请教如何对齐
print('{:<13}'.format(a), '\t\t', 1)
print('{:<10}'.format(b), '\t\t', 2)
print('{:<10}'.format(c), '\t\t', 3)
2020-05-20 11:02:13 +08:00
回复了 crella 创建的主题 Python 求组合的算法问题
擦,这玩意没法编辑格式吗
2020-05-20 11:01:48 +08:00
回复了 crella 创建的主题 Python 求组合的算法问题
import itertools
def get_slice_unequal(nums, groups):
datas = itertools.combinations(nums, groups[0])
if len(groups) == 1:
return [[list(item)] for item in datas]
res = list()
for item in datas:
for sub_item in get_slice_unequal(list(set(nums) - set(item)), groups[1:]):
new_item = [list(item)]
res.append(new_item + sub_item)
return res
2020-05-20 10:57:43 +08:00
回复了 crella 创建的主题 Python 求组合的算法问题
import itertools
def get_slice_unequal(nums, groups):
datas = itertools.combinations(nums, groups[0])
if len(groups) == 1:
return [[list(item)] for item in datas]
res = list()
for item in datas:
for sub_item in get_slice_unequal(list(set(nums) - set(item)), groups[1:]):
new_item = [list(item)]
res.append(new_item + sub_item)
return res


nums = [1, 2, 3, 4, 5, 6]
numsb = [2, 2, 1, 1]
res = get_slice_unequal(nums, numsb)
for item in res:
print(item)
print(len(res))
2020-04-02 17:46:32 +08:00
回复了 lucky4 创建的主题 Python 大家是怎么自动化部署 Django 项目的
Capistrano 不能部署 django ?
2019-12-31 11:55:38 +08:00
回复了 debugksir 创建的主题 Django Django 查询问题
for ind, item in enumerate(Score.objects.order_by('-grade').values('user_id', 'grade')[:100], 1):
if item['user_id'] == user_id:
return ind
else:
return -1
2016-08-05 12:52:04 +08:00
回复了 ideaplat 创建的主题 Python 有没有可以推荐的 dashboard 框架?
admin lte +1
2016-04-20 13:00:29 +08:00
回复了 saxon 创建的主题 职场话题 面试失败,回家考公....
我觉得 LZ 当前面临的最大问题不是做抉择找工作还是考公务员,而是楼主的心理承受能力(或者说抗挫折能力),就个面试失败了这么点小挫折就开始思前想后了,以后再碰到其他问题怎么办?不想灌输心灵鸡汤,但是我觉得就这么点事就立马转向这也太任性了点
2016-03-21 11:21:41 +08:00
回复了 dtysky 创建的主题 程序员 总是想搞个大新闻
“完美主义空想者” 这医生诊断得不错 @beingbin
2015-10-16 17:40:50 +08:00
回复了 cocacold 创建的主题 程序员 如何凝聚程序员的向心力?
@limuxy 绝对的,周末搞团建是个增加离心力的好方法

看 LZ 说的这个情况,团队情况已经比较危险了,就搞个团建能拉回来?我几个月前刚才一个类似的团队出来,除了领导,下面的员工之间其实早就形成了默契,大家都认定了现在的情况木有前途,没走的里面好几个也只是在找坑而已
2015-09-04 16:32:31 +08:00
回复了 pc10201 创建的主题 Python python 静态变量的问题
@ljcarsenal 嗯, c 系列语言过来的人容易被坑
1  2  3  4  5  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4873 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 47ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
Developed with CodeLauncher
♥ Do have faith in what you're doing.