Sure - but if that's the intended use case then perhaps we need a better
approach.

I tried to implement something like this with page permissions, but I don't
think they cover the case of moving a page:

http://mezzanine.jupo.org/docs/content-architecture.html#page-permissions

There really should be one way to implement these rules.




On Mon, May 26, 2014 at 11:23 PM, Ahmad Khayyat <[email protected]> wrote:

> Put another way: creating an instance is not a page move.
>
>
> On Mon, May 26, 2014 at 4:21 PM, Ahmad Khayyat <[email protected]> wrote:
>
>> Right. Yes, they can. But that would be handled by the save method of the
>> MyPage model (this is what I do in my app). I don't know of a way to handle
>> it in the page tree.
>>
>>
>> On Mon, May 26, 2014 at 4:18 PM, Stephen McDonald <[email protected]> wrote:
>>
>>> Seems incomplete for the use-case - couldn't the user create a new
>>> MyPage instance as a top-level page?
>>>
>>>
>>> On Mon, May 26, 2014 at 10:26 PM, Ahmad Khayyat <[email protected]>wrote:
>>>
>>>> ​Any comments?
>>>> Any additional information required?
>>>>
>>>> Here is an example that uses this feature to disallow pages of type
>>>> MyPage to be top-level pages:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> from mezzanine.pages.signals import pre_page_move
>>>> @receiver(pre_page_move, sender=MyPage)def my_move_constraints(sender, 
>>>> page, new_parent, **kwargs):
>>>>
>>>>     if new_parent is None:
>>>>         return "Pages of type MyPage cannot be top-level pages"
>>>>
>>>> ​If a user drags a MyPage to a top-level position in the page tree in
>>>> Mezzanine admin, the page will be moved back to its original position, and
>>>> an error message will be displayed using Django messages. The text of the
>>>> error message is the returned string: “Pages of type MyPage cannot be
>>>> top-level pages”. A subsequent valid move will remove the error message.​
>>>> ​
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Stephen McDonald
>>> http://jupo.org
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Mezzanine Users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/mezzanine-users/bIxUJkOIdUM/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>  --
> 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.
>



-- 
Stephen McDonald
http://jupo.org

-- 
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