Solving (partially) South issue on not updating permissions.

9 Mar

South have a already know issue [1] about no update permissions of added models. The common fix is run manage.py syncdb –all, Django Extensions [2] app also have a management command called update_permissions what is very usefull and also do the job.

But, any of us want to remember about that every time, so to automatize permissions creation I ‘copied’ idea of Django Extensions update_permissions command and put it to a method connect to a post_migrate [3] South signal. This do the job every time a app is migrated and with time can be extended to remove permissions also :). The code use built in Django features.

Here is the code, I put it in my project/__init__.py:

Links:
[1] http://south.aeracode.org/ticket/211
[2] http://packages.python.org/django-extensions/
[3] http://south.aeracode.org/docs/signals.html#post-migrate

VN:F [1.9.22_1171]
Rating: 5.0/5 (5 votes cast)
Solving (partially) South issue on not updating permissions., 5.0 out of 5 based on 5 ratings

3 Responses to “Solving (partially) South issue on not updating permissions.”

  1. Mark Harmison November 27, 2013 at %I:%M %p #

    This worked great until I found that my automated tests and some cron jobs stopped working because those script didn’t have DJANGO_SETTINGS_MODULE defined. There’s a thread here that does a good job describing the situation:

    https://github.com/jezdez/django-configurations/issues/38

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  2. Rodrigo Pinheiro Matias August 22, 2012 at %I:%M %p #

    I change the line 10

    import settings

    For

    from django.conf import settings

    For django work in evolution of settings.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)

Trackbacks and Pingbacks

  1. Alc.me blog - Useful way to automate permissions creation - March 19, 2014

    […] Or, better IMO, is the method used here […]

Leave a Reply