Hi Alex, I had the same problem and it almost drove me crazy. I even changed from MySQL to PostgreSQL to rule out the MySQL-DB constraints issue.
But the solution was far more simple: the command 'syncdb' already populates some tables, e.g. django_content_types and loaddata therefore tries to update the rows and throws 'duplicate key'-errors. Make sure you truncate all tables before 'loaddata' and you'll be fine. Greetings, Peter On 23 Aug., 21:15, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have quite complex application and want to make test suite for it. > Since its complex, I need some data being populated first, so trying > to find out how to make fixtures working. > > I think I am doing something absolutely wrong way. Since yesterday > trying to make fixtures working and get one problem after another. > > To isolate problems, I've created a very simple model: > > class People(models.Model): > first_name = models.CharField(maxlength=100) > last_name = models.CharField(maxlength=100) > > class Admin: > pass > > and added a few persons. > > Then, I am have exported data in all various formats, with hope that > one of them would work: > > ./manage.py dumpdata --format=python > data.python > ./manage.py dumpdata --format=json > [EMAIL PROTECTED] ./manage.py > dumpdata --format=xml > data.xml > > Now, trying to load it: > > ------------------------------------------------------------------------ > "json" fixture format loading produces this = error: > [EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ ./manage.pyloaddata > data.json > Loading 'data' fixtures... > Installing json fixture 'data' from absolute path. > Problem installing fixture 'data.json': duplicate keyviolatesunique > constraint "django_content_type_app_label_key" > ------------------------------------------------------------------------ > "python" fixture format produces this error: > [EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ ./manage.pyloaddata > data.python > Loading 'data' fixtures... > Installing python fixture 'data' from absolute path. > Problem installing fixture 'data.python': string indices must be > integers > [EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ > ------------------------------------------------------------------------ > xml fixture format produces this error: > [EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ ./manage.pyloaddata > data.xml > Loading 'data' fixtures... > Installing xml fixture 'data' from absolute path. > Problem installing fixture 'data.xml': duplicate keyviolatesunique > constraint "django_content_type_app_label_key" > > [EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ > > Every time I when I am installing fixture I do: > 1. Drop old database (dropdb fixtures) > 2. createdb fixtures > 3. ./manage.py syncdb > > and only then, I am attempting to load data. > > What I am doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---