Admin Change_list.py bug fixed (AssertionError: Negative indexing is not supported.)

664 views
Skip to first unread message

Guillaume Piot

unread,
Dec 21, 2011, 10:21:24 AM12/21/11
to django-cms...@googlegroups.com

There's a problem in the admin app of Django CMS.

Line 198 of change_list.py:


if page.root_node or self.is_filtered():

                page.last = True

                if len(children):

                    # TODO: WTF!?!

                    # The last one is not the last... wait, what?

                    children[-1].last = False


This action: [-1] is not supported by Django model query.

Line needs to changed to :

children[len(children)-1].last = False

It's a schoolboy error as Django support says!

Guillaume

Jonas Obrist

unread,
Dec 21, 2011, 1:52:58 PM12/21/11
to django-cms...@googlegroups.com
It is NOT!


It's an issue with django-mptt breaking their API in 0.5.0 and 0.5.2 (0.5.1 works). children should NOT be a queryset (it wasn't pre-0.5.0) because we pre-cache them, and you can negative index lists in python.
Reply all
Reply to author
Forward
0 new messages