4👍
✅
You can use QuerySet.filter
and QuerySet.update
:
chat.objects.filter(nick_from=sender_user, nick_to=receiver_user).update(recd='1')
3👍
I don’t really pay attention to the ORM-specific shims, favouring raw SQL instead. In django, you can easily do this:
chat.objects.raw(''''UPDATE chat SET recd="1" WHERE nick_from="%s" AND nick_to="%s"
''' % (sender_user, reciever_user))
If this doesn’t help, do leave a comment.
👤hd1
- [Django]-Django.db.utils.OperationalError: (1091, "Can't DROP 'company_id'; check that column/key exists")
- [Django]-Search field in Django Template
Source:stackexchange.com