How to load data to auth_permissions from initial_data.json when the auth_groups is also loaded from fixture?

154 views
Skip to first unread message

ycseattle

unread,
Oct 28, 2011, 1:48:19 PM10/28/11
to django...@googlegroups.com
Hi, 

In my application, I have fixed groups (like admin, staff, subscribers) etc, and this data in auth_groups is not intended to change in the program, so I am loading them in initial_data.json. I also want to load data into auth_group_permissions as the application is not expected to change it. The problem is that I noticed the table auth_permissions is generated by Django, so the permissions IDs will be dynamic (especially when I add new models as it seems the permissions are ordered by the model names). Is there a way to load my definition of group permissions through initial_data.json, or am I stuck with running a piece of code to do this? 

Thanks,
Yi

Jason

unread,
Nov 8, 2011, 4:57:11 PM11/8/11
to Django users
I'm investigating this as well. I just read that using the natural
keys dumpdata option might help.

https://docs.djangoproject.com/en/dev/topics/serialization/#topics-serialization-natural-keys
Reply all
Reply to author
Forward
0 new messages