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.py loaddata
data.json
Loading 'data' fixtures...
Installing json fixture 'data' from absolute path.
Problem installing fixture 'data.json': duplicate key violates unique
constraint "django_content_type_app_label_key"
------------------------------------------------------------------------
"python" fixture format produces this error:
[EMAIL PROTECTED] ~/tmp/fixture_troubles/FixtureTroubles $ ./manage.py loaddata
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.py loaddata
data.xml
Loading 'data' fixtures...
Installing xml fixture 'data' from absolute path.
Problem installing fixture 'data.xml': duplicate key violates unique
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---