Hi,
I'm using Django 1.5 with South to sync my database.
According to a hint on Stackoverflow I added the following code to my procjects __init__.py to add permissions on every migration:
from south.signals import post_migrate
def update_permissions_after_migration(app, **kwargs):
"""
Update app permission just after every migration.
This is based on app django_extensions update_permissions management command.
"""
import settings
from django.db.models import get_app, get_models
from django.contrib.auth.management import create_permissions
create_permissions(get_app(app), get_models(), 2 if settings.DEBUG else 0)
post_migrate.connect(update_permissions_after_migration)
Adding custom permissions via "class Meta:" seemed to work quite well with the above code.
But now I added permissions to a few models and some of them were not added to the permission table - without any error message, nothing.
This permission was added:
class Meta:
permissions = (
("view_equipmentcat", "Can see equipment categories"),
)
But not those (for example):
class Meta:
permissions = (
("view_equipment", "Can see equipment"),
)
class Meta:
permissions = (
("view_rooms", "Can see rooms"),
)
Is there a way to clear all custom permissions from auth_permission and force all custom permissions to be added again?
Thomas