1

I'm trying to create a comment system on my site. I'm using MPTT tree model and Django. Basically I would like to show the most recent post on top. When I try : order_insertion_by=['-creation_date'] I get this error : Comment has no field named '-creation_date'

obviously it doesn't get that the - is for DESC order.

Anyone knows how to sort a MPTT tree by DESC order ? Thanks

flo bee
  • 830
  • 2
  • 11
  • 20
  • Check your comment model. Does it have a `creation_date` field ? – karthikr Jul 02 '13 at 20:23
  • yes it does it's the - that's makes it not working. If I only put order_insertion_by=['creation_date'] it works but it's ASC and not DESC – flo bee Jul 03 '13 at 17:48

1 Answers1

2

This was fixed in the latest django-mptt version (just released 0.6.rc2), so if you're able to upgrade it should address your problem.

You'll need to install from git, since 0.6 isn't on PyPi yet, or wait another week or so for the final 0.6 release.

For reference the ticket was https://github.com/django-mptt/django-mptt/issues/170

craigds
  • 2,072
  • 14
  • 25