Another Slight Mistake...

December 27, 2007. Filed under blog 14

On Wednesday night I implemented some additional author functionality for LifeFlow (the django blogging software that this blog is implemented in), which allows each entry to be associated with 0+ authors.

This update went fine. Including migrating to the new database schema. But, I ran into some trouble in a seemingly innocuous task. In the django shell I ran:

from lifeflow.models import Author, Entry
a = Author.objects.get(pk=1)
for entry in Entry.objects.all():

The problem is with the way that I am currently dealing with manually setting many2many fields in the Entry model (by creating the object, and then editing it in a post save hook, and then saving it again, with a bit of code to prevent endless loops).

For whatever reason the rendering worked exactly right, except for the code snippets all got displayed as a string of data spew. Fortunately I was able to just manually save the entries one by one and everything worked properly again.

Not sure exactly what went wrong, but I need to do a bit of work improving that area anyway, so it should come out in time.