OK. I took another stab at it:
https://bitbucket.org/stephenmcd/mezzanine/pull-request/63/can_move-permission/

*Pull request description:*

Implement a new can_move dynamic page permission.

Content types can override can_move() to control whether a given page
move in the page tree is permitted. can_move() should return a
3-tuple: the permission (Boolean), an error message (String), and an
alternative new parent (Page). The last two elements are used only
when the permission is False.

Currently, the error message is used in page moves only to explain why the
page move is reverted. Also, the alternative new parent is used in page
creation only to insert the new page in a legal position.

During page creation, can_move() is called at the end, after all other
save-related operation
ā€‹sā€‹
are performed, including setting the slugs based on the original parent.
This may not be optimal, as it may result in an additional save, but it is
a clean and simple way. Trying to call can_move() any earlier is tricky,
because the specific content type that defines can_move() is attached to
the Page instance only after it has been saved.

Calling can_move() during page creation is separated into its own commit (
5d2e613 <https://bitbucket.org/stephenmcd/mezzanine/commits/5d2e613>).
ā€‹

-- 
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to