Whats the difference between DjangoModelPermissions and DjangoObjectPermissions?
I'm still learning Django and DRF and according to the docs, they seems to do exactly the same thing.
DjangoModelPermissions: This permission class ties into Django's standard django.contrib.auth model permissions.
DjangoObjectPermissions This permission class ties into Django's standard object permissions framework that allows per-object permissions on models
For the later, it seems like it has something to do with Django’s permission framework foundation which has no implementation. and apparently, django-guardian fills in this gap.
In Django admin, I'm able to assign a Model's CRUD permission to users and groups, so what does the later add?
I'm trying to wrap my head around this permission system. What are the differences and what should I know about them?
DjangoModelPermissions
is all about permissions to interact with a database table which are represented as models in code while DjangoObjectPermissions
are permissions to interact with individual rows in the table which are model instances in code.
Basically, the object permissions are granular permissions which give access to some rows in a table but can restrict access to other rows in the same table
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