[Django]-Django – Permissions to proxy model

6πŸ‘

βœ…

This is a known issue. There is a recently updated pull request to fix it, so with any luck it will be fixed in the next version of Django.

In the mean time there are some suggested workarounds in the ticket above. The simplest seems to be to manually create a migration for an un-managed model that points to your proxy model, which will then trigger the appropriate permission objects to be created:

migrations.CreateModel(
    name='InstitutionOwnerGroup',
    fields=[
    ],
    options={
        'verbose_name': 'Group',
        'managed': False,  # Make it unmanaged
        'proxy': True,
        'verbose_name_plural': 'Groups',
    },
    bases=('myapp.proxies.group',),
    managers=[
        ('objects', django.contrib.auth.models.GroupManager()),
    ],
),

Your mileage may vary with this – I’m not sure it is entirely safe to do.

πŸ‘€solarissmoke

Leave a comment