How to django update related fields? -
how updtae data related field.
user.objects.filter(id=int(getupdate['uid'])).update(cnf_user__user_code=getupdate['code'])
it's not work.
this model.
class cnf_user(models.model): # field required. user = models.onetoonefield(user) user_code = models.charfield(max_length=50,default='-') user_tel = models.charfield(max_length=50,default='-') user_status = models.integerfield(default=1) user_level = models.charfield(max_length=50,default='-')
why not?
cnf_user.objects.filter(user_id=int(getupdate['uid'])).update(....)
btw, cnf_user
not proper name class in python :p better cnfuser
or full meaning of "cnf" maybe configuser
:p?
same fields:
user_code -> user_code
Comments
Post a Comment