S
S
Soslan Aldatov2022-04-01 07:32:19
Django
Soslan Aldatov, 2022-04-01 07:32:19

Is there a Django battery for managing permissions based on the value of a model field?

I would like to be able to manage the rights to change model instances from the admin panel based on the value of one of the fields of this very model.

Here's an example: we have an Organization model with a is_production. We also have two roles: Developers and Customer Support. I want users from the Developers group to be able to edit only those organizations that have is_production = False, and users from Customer Support to only those that have is_production = True. Are there any no-code/low-code, like batteries, ways to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-04-01
@sptm

This task does not require a battery, it is enough to override get_queryset or has_change_permission in ModelAdmin. And so, the bulk of the batteries here https://djangopackages.org/grids/g/perms/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question