divio/django-cms — Issue #1099: admin/change_list.py: Negative indexing is not supported
Author: benjaoming
Created: 2011-11-26 00:21:15+00:00
State: open

I do not understand the logic of this code block, and it seems from the comments in it that it's also a bit funky :) Anyways, I have been hitting it, and I don't know why*). But after changing this line, it works fine.

if len(children):
# TODO: WTF!?!
# The last one is not the last... wait, what?
children[-1].last = False

should be changed to:

if len(children):
# TODO: WTF!?!
# The last one is not the last... wait, what?
children[children.count()-1].last = False

*) except that it works on a Ubuntu 8.04 server with Django 1.3.1 but not on Ubuntu 11.10 -- so perhaps it has something to do with python-mysqldb.