Fixing a category assigned with itself as parent in Satchmo
Posted on | June 3, 2008 | 1 Comment
One annoying possibility in Satchmo is that administrators sometimes accidentally set a category as its own parent. This causes an infinite loop and hangs the site. So you can’t even use Django to fix the error.
Luckily, the solution is simple. At the commandline do like so:
/opt/webapps/mystore $ ./manage.py dbshell
mysql> update product_category set parent_id=null where id=parent_id;
mysql> quit
Problem solved.
Technorati Tags: satchmo, django
Category: Satchmo
Comments
One Response to “Fixing a category assigned with itself as parent in Satchmo”
Leave a Reply
June 3rd, 2008 @ 12:01 pm
I had a similar problem with Pages in our CMS — you could assign a page’s parent to be itself.
The more preemptive solution we decided on was to simply override save(), and set `parent = None` if self.parent = self.