I create a proxy model from auth.Group model, that I want to apply permissions to it.
proxies.py
class InstitutionOwnerGroup(Group):
# Gestores
pk = 1
is_superuser = False
is_staff = False
class Meta:
proxy = True
permissions = (
('can_manage_institutions', 'Gerencia Instituições'),
)
data migration
# Generated by Django 2.1.1 on 2018-10-14 23:30
from django.db import migrations
from horsy.apps.accounts.proxies import InstitutionOwnerGroup
def create_owner_group(app, _schema):
InstitutionOwnerGroup.objects.create(
name="Gestores"
)
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_add_admin_user'),
]
operations = [
migrations.RunPython(create_owner_group)
]
Gestores model in admin panel:
The given permission can_manage_institutions isn't been applied to model in data migration.
How to apply a permission by using django permission system to a proxy model inherited from auth.Group ?
from Django - Permissions to proxy model

I like your blog, I read this blog please update more content on python, further check it once at python online training
ReplyDelete