How to construct a where clause using Django models:
insert in to tablename where email=emailaddress
Thanks.
I think you are rather looking for a possibility to UPDATE an existing object.
obj=MyModel.objects.get(email=emailaddress)
obj.name = 'xxxx'
obj.save()
In case the email address is not unique, which is strange but let's suppose that, you should use the filter method and loop on result
users = MyObject.objects.filter(email=emailaddress)
for u in users:
# your change here
u.is_superuser = True
u.save()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With