Re: [mezzanine-users] Need to have the same page in multiple locations in the page tree, how link them?

2018-02-14 Thread Ken Bolton
On Wed, Feb 14, 2018 at 9:24 AM, Roger van Schie 
wrote:

>
> I think I will just extend the Page model to include a foreign key, and
> then add another check into the template tag to see whether the child page
> currently being "inspected" has a foreign key or not, and if it does, just
> to go one level deeper to get the info it needs.
>

I don't think you need to get that complicated. The `Page` model is aware
of all of its `Displayable` children, whether `Link` or 'RichTextPage`.
Your menu should iterate through all of them, going as deep or shallow as
you like.

Entirely possible we're both misunderstanding each other; I'll blame lack
of both cognitive ability and caffeine on this end.

-ken

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


Re: [mezzanine-users] Re: Mezzanine 3.1.10: Can't delete the media files in the admin page

2018-02-14 Thread Simon Bradley
For anyone else using windows. There was another small issue.

This line in views.py:

# CREATE FILEOBJECT
url_path = "/".join([s.strip("/") for s in
[get_directory(), path, file] if s.strip("/")])

Changed it to:

# CREATE FILEOBJECT
url_path = "/".join([s.strip("/") for s in
[get_directory(), path.replace("\\", "/"), 
file] if s.strip("/")])


This might not be the best way to solve the problem but if you just want to 
get it working on windows it does seem to do the trick.



On Tuesday, February 13, 2018 at 8:28:42 AM UTC, Simon Bradley wrote:
>
> Will do.
>
> On Monday, February 12, 2018 at 10:28:00 PM UTC, Stephen McDonald wrote:
>>
>> Could you create a pull request with your fix? That'd be great, thank you.
>>
>> On Tue, Feb 13, 2018 at 7:14 AM, Simon Bradley  
>> wrote:
>>
>>> OK def fixed it now
>>>
>>> This line in the views.py of filebrowser-safe:
>>>
>>> if not normalized.startswith(get_directory()) or ".." in normalized:
>>>
>>> It appears to be the problem.
>>>
>>> I changed it to:
>>>
>>> if not normalized.startswith(get_directory().strip("/")) or ".." in 
>>> normalized:
>>>
>>> Removed the FILEBROWSER_DIRECTORY entry from the local_settings.py 
>>> because i generally stick with the default path anyway.
>>>
>>> Tested everything. Looks like it's working. I know there was a bit of a 
>>> false alarm before but this time i'm fairly sure.
>>>
>>> If there's a simpler way to get around this though i'd like to know it.
>>>
>>> It's a bit of a faff having to have my own version of filebrowser-safe 
>>> for every mez proj.
>>>
>>>
>>>
>>>
>>>
>>> On Monday, February 12, 2018 at 7:54:20 PM UTC, Simon Bradley wrote:

 A!

 Now i can't navigate in the media library.

 LOL!

 Still. Bound to be able to figure it out from here!

 On Monday, February 12, 2018 at 7:47:15 PM UTC, Simon Bradley wrote:
>
> Also, thanks to Mathias.
>
> It was your advice that led me to it.
>
> - Uninstalled filebrowser-safe
> - Cloned a fresh one from the repo
> - did setup.py develop
> - fiddled with the messages from delete
> - found said problem
>
>
> On Monday, February 12, 2018 at 7:43:46 PM UTC, Simon Bradley wrote:
>>
>> Well i found the problem.
>>
>> Very silly. Silly windows user.
>>
>> filebrowser-safe get_directory() picks up the directory from 
>> settings.py or the default 'uploads/' and it's as simple as that it 
>> seams.
>>
>> Because for it to work on windows the path needs to be 'uploads\'
>>
>> A backslash. That's it.
>>
>> So i just added this:
>>
>> FILEBROWSER_DIRECTORY = 'uploads\\'
>>
>> To my local_settings.py and now we're good.
>>
>> Hope this helps some people.
>>
>>
>> On Saturday, February 10, 2018 at 7:12:02 PM UTC, Simon Bradley wrote:
>>>
>>> Yo!
>>>
>>> Does anyone have any idea about this? Googling it seems to suggest 
>>> it has lingered for several years. It's a real annoyance because 
>>> overall i 
>>> really like mezzanine and have developed a couple of sites with it now. 
>>> I'm 
>>> also using windows 10 and everything else works great.
>>>
>>> Would be great if i had any kind of workaround for this.
>>>
>>> Anyone any idea?
>>>
>>> Anyone at all?
>>>
>>> I mean i spent a fair amount of time fiddling with it. Looking here: 
>>> https://docs.python.org/3/library/os.html
>>>
>>> It says this: 
>>> Although Windows supports chmod() 
>>> , you can only 
>>> set the file’s read-only flag with it (via the stat.S_IWRITE and 
>>> stat.S_IREADconstants or a corresponding integer value). All other 
>>> bits are ignored.
>>>
>>> Now i'm not really all that knowledgeable in this area but is that 
>>> saying that because Mezzanine uses chmod that you can't actually change 
>>> the 
>>> file permissions on windows through mezzanine?
>>>
>>> If so could there be another way? Maybe changing the file 
>>> permissions in windows explorer somehow?
>>>
>>> Welcome a discussion here folks. I know someone out there knows more 
>>> about this than i do. In fact i suspect their number may be legion.
>>>
>>>
>>>
>>>
>>> On Wednesday, November 29, 2017 at 8:42:17 PM UTC, Alexander Yang 
>>> wrote:

 Hi. I'm trying Mezzanine on Windows 10 and facing this same issue. 
 I can't delete images from the media library in the admin interface. 
 Same 
 error message. Did you manage to solve this?

 Thanks,

 Alex


 On Friday, 27 March 2015 02:41:22 UTC+1, Wan Hsin Mao wrote:
>

Re: [mezzanine-users] Need to have the same page in multiple locations in the page tree, how link them?

2018-02-14 Thread Roger van Schie
Hi Ken

I might be missing your point, or misunderstanding something completely,
but templating is not a problem for me, I've written the models/templates
in such a way, that depending on what information they put into the page,
various parts of the page template get displayed or not, and hence I'm able
to reuse the same template for all levels (which is actually infinite, as
far as mezzanine / django will allow).

All I'm really doing is creating a fancy menu (besides the basic intro's
etc ), displaying the children pages as graphical images, which I propagate
into the template using template tags to pull the hero image's location
instead of just their name. All this works perfectly fine.

I think I will just extend the Page model to include a foreign key, and
then add another check into the template tag to see whether the child page
currently being "inspected" has a foreign key or not, and if it does, just
to go one level deeper to get the info it needs.

Still open to suggestions or corrections.

Thanks
Roger


On 14 February 2018 at 15:25, Ken Bolton  wrote:

> Hi Roger,
>
> It is possible to do some terrifying things with the page templates. Read
> http://mezzanine.jupo.org/docs/content-architecture.html#page-templates.
> (Tortured language in that section is largely my fault, and improvements
> are welcome.) I have managed to create "content inheritance trees" across
> `Displayable`s by (ab)using the Mezzanine page templates.
>
> A note of caution: a lot of folks think their content and architecture is
> unique, a special butterfly that doesn't fit long-established information
> architecture patterns. I have yet to find a case where that is true, though
> I acknowledge your client may have found it. Often, it only takes careful
> management by engineering to help the customer past this.
>
> hth,
> ken
>
> On Wed, Feb 14, 2018 at 3:47 AM, Roger van Schie  > wrote:
>
>> Hi Everyone
>>
>> As far as I can tell, the "Link" page won't work for me because I pull
>> information from the child page to display in the parent page. Basically,
>> my client has different categories, and within those categories they have
>> sub-categories, and so on, all built using the page tree structure. The
>> sub-categories are displayed on the category page on a "card", with an
>> image that is pulled from the sub-category page. I've basically created a
>> custom menu, where the child pages' display more than just the title.
>>
>> Would an appropriate approach be to extend the link model to include a
>> foreign key linking to the actual page? Or should I just extend the Page
>> model with a foreign key to point to the other page? Anyone got a better
>> suggestion / solution?
>>
>> Regards
>> Roger
>>
>> On 8 February 2018 at 22:34, Danny  wrote:
>>
>>> On 8/02/2018 9:18 PM, Roger van Schie wrote:
>>>
 Hi Everyone

 I have a use case where the client basically wants a rich text field
 page to write about a certain product, but this product falls under
 different categories. Each category is higher up in the branch hierarchy,
 and they want that same page(the rich text field page) to be displayed in
 multiple categories.

 My current thinking is to just create a custom page model that has a
 foreign key to the other page and put that in the page tree. Would this be
 the best approach?

>>>
>>> An easier way to do it is to have the actual page at one place in the
>>> hierarchy, and then use a 'Link' page elsewhere to automatically go to this
>>> page. I've done this before, no troubles.
>>>
>>> It will mean that when viewing the page it will always just have the one
>>> breadcrumb trail, but it will still be available from two places within the
>>> navigation menus.
>>>
>>> Seeya. Dnany.
>>>
>>>
>>> --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>

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

Re: [mezzanine-users] Need to have the same page in multiple locations in the page tree, how link them?

2018-02-14 Thread Ken Bolton
Hi Roger,

It is possible to do some terrifying things with the page templates. Read
http://mezzanine.jupo.org/docs/content-architecture.html#page-templates.
(Tortured language in that section is largely my fault, and improvements
are welcome.) I have managed to create "content inheritance trees" across
`Displayable`s by (ab)using the Mezzanine page templates.

A note of caution: a lot of folks think their content and architecture is
unique, a special butterfly that doesn't fit long-established information
architecture patterns. I have yet to find a case where that is true, though
I acknowledge your client may have found it. Often, it only takes careful
management by engineering to help the customer past this.

hth,
ken

On Wed, Feb 14, 2018 at 3:47 AM, Roger van Schie 
wrote:

> Hi Everyone
>
> As far as I can tell, the "Link" page won't work for me because I pull
> information from the child page to display in the parent page. Basically,
> my client has different categories, and within those categories they have
> sub-categories, and so on, all built using the page tree structure. The
> sub-categories are displayed on the category page on a "card", with an
> image that is pulled from the sub-category page. I've basically created a
> custom menu, where the child pages' display more than just the title.
>
> Would an appropriate approach be to extend the link model to include a
> foreign key linking to the actual page? Or should I just extend the Page
> model with a foreign key to point to the other page? Anyone got a better
> suggestion / solution?
>
> Regards
> Roger
>
> On 8 February 2018 at 22:34, Danny  wrote:
>
>> On 8/02/2018 9:18 PM, Roger van Schie wrote:
>>
>>> Hi Everyone
>>>
>>> I have a use case where the client basically wants a rich text field
>>> page to write about a certain product, but this product falls under
>>> different categories. Each category is higher up in the branch hierarchy,
>>> and they want that same page(the rich text field page) to be displayed in
>>> multiple categories.
>>>
>>> My current thinking is to just create a custom page model that has a
>>> foreign key to the other page and put that in the page tree. Would this be
>>> the best approach?
>>>
>>
>> An easier way to do it is to have the actual page at one place in the
>> hierarchy, and then use a 'Link' page elsewhere to automatically go to this
>> page. I've done this before, no troubles.
>>
>> It will mean that when viewing the page it will always just have the one
>> breadcrumb trail, but it will still be available from two places within the
>> navigation menus.
>>
>> Seeya. Dnany.
>>
>>
>> --
>> 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.
>>
>
> --
> 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.
>

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


Re: [mezzanine-users] Need to have the same page in multiple locations in the page tree, how link them?

2018-02-14 Thread Roger van Schie
Hi Everyone

As far as I can tell, the "Link" page won't work for me because I pull
information from the child page to display in the parent page. Basically,
my client has different categories, and within those categories they have
sub-categories, and so on, all built using the page tree structure. The
sub-categories are displayed on the category page on a "card", with an
image that is pulled from the sub-category page. I've basically created a
custom menu, where the child pages' display more than just the title.

Would an appropriate approach be to extend the link model to include a
foreign key linking to the actual page? Or should I just extend the Page
model with a foreign key to point to the other page? Anyone got a better
suggestion / solution?

Regards
Roger

On 8 February 2018 at 22:34, Danny  wrote:

> On 8/02/2018 9:18 PM, Roger van Schie wrote:
>
>> Hi Everyone
>>
>> I have a use case where the client basically wants a rich text field page
>> to write about a certain product, but this product falls under different
>> categories. Each category is higher up in the branch hierarchy, and they
>> want that same page(the rich text field page) to be displayed in multiple
>> categories.
>>
>> My current thinking is to just create a custom page model that has a
>> foreign key to the other page and put that in the page tree. Would this be
>> the best approach?
>>
>
> An easier way to do it is to have the actual page at one place in the
> hierarchy, and then use a 'Link' page elsewhere to automatically go to this
> page. I've done this before, no troubles.
>
> It will mean that when viewing the page it will always just have the one
> breadcrumb trail, but it will still be available from two places within the
> navigation menus.
>
> Seeya. Dnany.
>
>
> --
> 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.
>

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