Debugging Problems with Django Fixtures

I always hate seeing an error message while loading JSON fixtures while running syncdb after making some changes to my tables.

One major problem is that the table and field of the fixture isn’t outputted in the event of an error. Even specifying the verbosity=2 doesn’t help at all. How worthless is the following error?

yeago@tryonia:~/dev/projekt-x$ python manage.py syncdb
Installing json fixture 'initial_data' from '/home/yeago/dev/projekt-x/../projekt-x/consumers/fixtures'.
Problem installing fixture '/home/yeago/dev/projekt-x/../projekt-x/consumers/fixtures/initial_data.json': [u'This value must be either True or False.']

This value?! What value?! What field!?

Solution

1) vim /path/to/django/db/models/fields/__init__.py

2) scan for the error message (”This value must be either True or False” in my case)

3) before the ‘raise’ statement. import pdb then do pdb.set_trace(). Viola!

yeago@tryonia:~/dev/projekt-x$ python manage.py syncdb
Installing json fixture 'initial_data' from '/home/yeago/dev/projekt-x/../projekt-x/consumers/fixtures'.
> /usr/lib/python2.4/site-packages/django/db/models/fields/__init__.py(489)to_python()
-> raise validators.ValidationError, _("This value must be either True or False.")
(Pdb) self
<django.db.models.fields.BooleanField object at 0x409d3d6c>
(Pdb) self.verbose_name
'vampire victim recent'
(Pdb) fuck yeah!
*** SyntaxError: invalid syntax (, line 1)

Leave a Reply

Add to Technorati Favorites

Orlando Web Design by EAI