diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-08-04 10:11:24 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-08-04 10:11:24 +0300 |
commit | 63b0fc6269b38edf7234b9f151b80d81f614c0a3 (patch) | |
tree | 555de3068f33f8dddb4619349bbea7d9b7c822fd /__init__.py | |
download | Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.tar.gz Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.tar.bz2 Servo-63b0fc6269b38edf7234b9f151b80d81f614c0a3.zip |
Initial commit
First public commit
Diffstat (limited to '__init__.py')
-rw-r--r-- | __init__.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..74b4ba7 --- /dev/null +++ b/__init__.py @@ -0,0 +1,16 @@ +# register a signal do update permissions every migration. +# This is based on app django_extensions update_permissions command +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. + """ + from django.conf 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) |