Hello, 

Just wondering how to create groups automatically in Django and
automatically assign permissions? 

Sounds easy. I have created a database migration to do just this. 

The problem is under Django the permissions are not created until after
all the migrations are finished. So the resultant migration works fine
on my development box, but fails badly on new installs, including tests.


Looking at slashdot, I see questions like
https://stackoverflow.com/questions/42743825/how-to-create-groups-and-assign-permission-during-project-setup-in-django
which recommend setting up a post_migrate signal handler. Unfortunately,
signal handlers in Django are unordered, there is no guarantee our
handler will be called after the one that creates the permissions. 

I could also have some sort of button in Django Admin that needs to be
manually pressed - would happen after permissions are created. Seems to
me though that doing significant changes to the database group table
from a HTTP request may not be ideal... 

Any other suggestions? I am somewhat surprised that this situation
doesn't seem to have any good answers. 

Regards
_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to