Suppose I have some models: Class MyModel, MyModel1, …
How can I prevent others to call :
MyModel.objects.update(field=xxx)
MyModel.objects.delete()
Suppose I have some models: Class MyModel, MyModel1, …
How can I prevent others to call :
MyModel.objects.update(field=xxx)
MyModel.objects.delete()
Welcome @notnotdinner !
You can’t.
Any code in your project can do anything that your project can do. (Who are the “others” that you are trying to protect yourself from?)
welcome @notnotdinner
if user have specific role in the system, try to throw an error on the basic of that.
i mean suppose there are user_type admin, branch_user, zonal_user
and you only want zonal, and admin can call update or delete, try to put this kind of validation.