[Fixed]-Django model permissions not picked up on admin

15👍

try:

manage.py syncdb --all

Otherwise, You can force django to generate permissions for a particular app:

from django.contrib.auth.management import create_permissions
from django.apps import apps

create_permissions(apps.get_app_config('my_app_name'))

This will do all models in the app. You can substitute a list of model class objects instead of ‘get_models()’ if you only want a subset.

👤joshua

3👍

What you need to do is a syncdb each time you add/modify a permission for a model.

 python manage.py syncdb
👤Darwin

-5👍

python manage.py migrate --fake

Leave a comment