【Django】Admin重写保存按钮
def save_model(self, request, obj, form, change): super().save_model(request, obj, form, change)
# 扩展保存按钮,obj是保存的model对象 if obj.action == 1: # 通过 user_obj = models.UserInfo.objects.get(username=obj.username) models.UserInfo.objects.filter(username=obj.username).update(money=user_obj.money + obj.money) else: pass
Python全栈(后端、数据分析、脚本、爬虫、EXE客户端) / 前端(WEB,移动,H5) / Linux / SpringBoot / 机器学习