4π
(Updated)
Youβre right (re your comments below). The problem is indeed with auth.permission
.
When you run syncdb
, auth.permission
is populated automatically with default values for all installed models. Any subsequent runs of syncdb
will add new entries for any models that were recently added.
If at a later stage you reset the database and run syncdb
again, the values will be repopulated and depending on the order in which installed models are inspected, the associated permissions may be added in a different order giving it different ids from your previous database (if models were installed in stages).
To avoid this problem, you can either leave auth.permission
out when dumping your auth
data (as youβve already pointed out in your comments), or resetting the auth.permission
table before loading your data dump.
Also, it is important to use natural keys (--natural
) when dumping out your data so that it does not reference related data using its integer id (which may not be the same when loaded in another db). This feature was introduced in Django 1.2.