Re: Read Only by user in Django Admin

2017-02-20 Thread Juan Corrales Araya
Hi. The answer is very simple. you have to install *django-admin-view-permission* then you have to added on setting INSTALLED_APPS = [ ... 'admin_view_permission', ... ] finally you have to run:* python manage.py migrate* You will see that the permission will already be availa

Re: Read Only by user in Django Admin

2016-10-28 Thread Olivier Dalang
Hi, The following PR is ready to merge and implements this: https://github.com/django/django/pull/6734 I will squash the commits as soon as I'm back in the office (next week) and it will probably be merged soon. Bests Olivier On 25 Oct 2016 19:03, "Luis Zárate" wrote: > you are looking some

Re: Read Only by user in Django Admin

2016-10-25 Thread Luis Zárate
you are looking something like https://code.djangoproject.com/ticket/7150 https://code.djangoproject.com/attachment/ticket/7150/admin_view-permission-1.0.patch https://code.djangoproject.com/attachment/ticket/7150/newforms-admin-view-permission-r7737.patch https://code.djangoproject.com/ticket/8936

Re: Read Only by user in Django Admin

2016-10-24 Thread Derek
Would it be possible to add these extra admin methods into a parent class; and then have all your individual model admins inherit from it? Ditto for the models.py On Sunday, 8 February 2015 21:15:42 UTC+2, Hangloser Firestarter wrote: > > Solved. > > In __init__.py > ... > from django.db.models

Re: Read Only by user in Django Admin

2016-10-24 Thread Naveen Kumar
Hello, This looks perfect when i don't have any fields in list_editable. This code is not working with list_editable. On Sunday, February 8, 2015 at 8:14:26 PM UTC+5:30, Hangloser Firestarter wrote: > > Hello. > I am using the admin backend of a system, but not all users of this > backend can

Re: Read Only by user in Django Admin

2015-02-08 Thread Hangloser Firestarter
Solved. In __init__.py ... from django.db.models.signals import post_syncdb from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission def add_view_permissions(sender, **kwargs): """ This syncdb hooks takes care of adding a view permission

Re: Read Only by user in Django Admin

2015-02-08 Thread Edgar Gabaldi
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 f

Re: Read Only by user in Django Admin

2015-02-08 Thread Hangloser Firestarter
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 django-u

Re: Read Only by user in Django Admin

2015-02-08 Thread Edgar Gabaldi
The ModelAdmin has a method get_readonly_fields [1]. You can override this method and check a custom permission[2]. [1] https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_readonly_fields [2] https://docs.djangoproject.com/en/1.7/ref/models/options/#permiss

Read Only by user in Django Admin

2015-02-08 Thread Hangloser Firestarter
Hello. I am using the admin backend of a system, but not all users of this backend can access all system models. By default Django is the roles ADD, EDIT and DELETE, I wonder if anyone has customized the model auth.permission to generate a permission 'read only' to Django Admin? Or if you have