Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not supporting in Django 2 #7

Open
ManojDatt opened this issue Sep 27, 2019 · 5 comments
Open

Not supporting in Django 2 #7

ManojDatt opened this issue Sep 27, 2019 · 5 comments

Comments

@ManojDatt
Copy link
Collaborator

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.

@ManojDatt
Copy link
Collaborator Author

I have fixed and updated code over django2 branch.

@sainipray
Copy link
Owner

Can you generate PULL request to master so I'll merge it

@Coderknight439
Copy link

Coderknight439 commented Oct 30, 2019

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?
Screenshot (35)

@mjrulesamrat
Copy link

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?
Screenshot (35)

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

@ManojDatt
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants