Friday, October 28, 2011

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

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/D1x0zXQVzAcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment