In the get_readonly_fields, you have access to the request.user, you can
check the permission inside the method, something like that:
def get_readonly_fields(self, request, obj=None):
if obj and not request.user.has_perm('your_app.your_custom_permission'):
# return a tuple with all fields that needs to be read only.
return None
You can add your custom permission to a group.
On Sun, Feb 8, 2015 at 12:55 PM, Hangloser Firestarter <[email protected]>
wrote:
> Gabaldi.
>
> Can I integrate this get_readonly_fields with auth.groups?
>
> And show whitelisted django admin.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e376a4ce-dd8d-4ba9-9dbd-f0fbfc96bd96%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e376a4ce-dd8d-4ba9-9dbd-f0fbfc96bd96%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAGjPPHmmTuX2%3DoAn24My0j%2BhZdthWcajSPfrLHoa6%3D8ase6jhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.