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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c6bbe2cd-1f77-462e-9d09-588179c909bb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to