django-mptt/django-mptt — Issue #175: order_insertion_by filters should be calculated after pre_save() methods
Author: craigds
Created: 2012-03-07 21:49:56+00:00
State: open

At present we figure out where to insert new nodes in get_ordered_insertion_target(), which gets called from save() before the superclass's save() gets called.

This is kind of bad because it means field.pre_save() hasn't yet been called for the relevant fields.

As a result, specifying a datetime field with auto_add_now=True in insertion_order_by will not currently work, because the value is not set until field.pre_save() is called. Reported in this SO post: http://stackoverflow.com/questions/9596115/how-to-order-django-mptt-tree-by-datetimefield