djadmin
djadmin copied to clipboard
Not supporting in Django 2
It is not supporting in Django 2,I have fixed this issue on my local. If possible add me as a contributor so that i can make those changes, Or You need to fix few changes i am attaching a file for this fixes please update.
I have fixed and updated code over django2 branch.
Can you generate PULL request to master so I'll merge it
I want to use it and i fixed issues in django latest. But I am not getting permission options while adding user or group from admin. Can you help?
I want to use it and i fixed issues in django latest. But I am not getting permission options while adding user or group from admin. Can you help?
Not sure if this helps but there some updates regarding permissions in latest Django. Please check. https://docs.djangoproject.com/en/3.0/releases/2.1/#considerations-for-the-new-model-view-permission
Install latest from :
pip install git+https://github.com/sainipray/djadmin.git@django2
And add this in your admin.
from django.contrib.auth.admin import GroupAdmin
from django.contrib.auth.models import Group
class CustomGroupAdmin(GroupAdmin):
def formfield_for_manytomany(self, db_field, request=None, **kwargs):
if db_field.name == 'permissions':
qs = kwargs.get('queryset', db_field.remote_field.model.objects)
qs = qs.exclude(codename__in=(
'add_permission',
'change_permission',
'delete_permission',
'add_contenttype',
'change_contenttype',
'delete_contenttype',
'add_session',
'delete_session',
'change_session',
'add_logentry',
'change_logentry',
'delete_logentry',
))
kwargs['queryset'] = qs.select_related('content_type')
return super(GroupAdmin, self).formfield_for_manytomany(
db_field, request=request, **kwargs)
admin.site.register(Group, CustomGroupAdmin)
This will allow you to add permission for groups.