如果它与 abc 匹配,我想更改任何数据库变量的名称。
def icall(modeladmin, request, queryset):
for pri in queryset:
print('from test:', pri.name, pri.title) # priting if working fine
if pri.name == 'abc': # loop is matching the condition
pri.update(name='zzz') ## the value is not getting update in DB
else:
print("gg not mached")
操作系统在pri.update(name='zzz')
这里不起作用。
有人可以帮助我了解根据 if else 条件更新数据库的正确语句。