Objective

Support arbitrary rules in the page tree, e.g. some content types have to
always by under some other types, or specific objects, and having sections
of the page tree that are exclusive to some specific content type(s).
Description

The 
admin_page_ordering<https://bitbucket.org/stephenmcd/mezzanine/src/3db5e7243faa18332668dd596db2b7f0128a0161/mezzanine/pages/views.py?at=default#cl-15>view
of the
pages app is responsible for performing the reordering of pages as a result
of a drag-and-drop of pages in the page change list (tree) in the admin.

It would be very useful to expose the IDs of the page being moved and its
new parent to some other user code, so that it can decide whether to go
ahead with the move, or abort it. This can be done by having the view above
send a pre_page_move signal with those two arguments. A receiver can abort
the change by setting its return value.

What I do now is that I:

   1.

   override the url of the view above, and coerce it to go to a custom view
   instead
    2.

   duplicate some of the code in the view above in my custom view to obtain
   the IDs of the page being moved and the new parent
    3. perform some logic on these two IDs to decide whether to call the
   original view to perform the move, or not to call it to abort the move
   4. in case the move is aborted, the page may need to be reloaded to put
   the moved page back where it was in the admin page tree. This can be done
   very neatly and consistently using django messages, but that requires a
   tiny modification of Mezzanine’s page_tree.js. This is a solved problem.

If this proposal is accepted, all is needed, instead, is to subscribe to
the signal, perform the logic on the provided argument, and return the
decision, maybe along with a message explaining the problem, if possible
(is it?).

*What do you think?*
​

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to