Re: [mezzanine-users] Question about Blog and Links to categories

439 views
Skip to first unread message

Stephen McDonald

unread,
Jul 2, 2012, 4:30:54 PM7/2/12
to mezzani...@googlegroups.com
I can't replicate what it sounds like you're trying to do - in the admin I went into "Pages", added a new "Link" with the URL "/blog/category/django/", and it works fine.

PS new posters to the mailing list need to be approved, so we can reject spam, which is why your message didn't show up right away.

On Mon, Jul 2, 2012 at 11:15 PM, Markus Törnqvist <m...@nysv.org> wrote:
Hi!

(Had some issues, apparently, getting through by email, so let's try the web instead.)

I can create a Link on the top level of the menu ok, to /blog/category/main.

What I can not do is add category-Link objects under the main menu item,
because the Link loses its url attribute and points to /blog/main instead.

This is sort of annoying; I might be able to hack it with UPDATE TABLE in SQL
but that's not very user friendly or correct - it would be more valuable to
know why this is what it is and then make it sane.

Thanks!

--
mjt




--
Stephen McDonald
http://jupo.org

Markus Törnqvist

unread,
Jul 2, 2012, 4:39:08 PM7/2/12
to mezzani...@googlegroups.com
On Tue, Jul 03, 2012 at 06:30:54AM +1000, Stephen McDonald wrote:
>I can't replicate what it sounds like you're trying to do - in the admin I
>went into "Pages", added a new "Link" with the URL
>"/blog/category/django/", and it works fine.

On the top level, along with the main link to the blog, it works for me.

This site is in Finnish, but fwiw the top-level link is
/blog/category/p��kirjoitus and it filters just fine.

Did you try to add to the blog Page? From next to the arrows and X?

I got Title, and URL there as expected. Then Save and continue editing, and
URL is gone from the edit field(!!) I had typed in /blog/category/artikkeli

So I look at my menu in another tab and the entry is there. With the wrong
url. The url I ended up with is /blog/artikkeli :|

(Localized URLs would also be nice ;)

>PS new posters to the mailing list need to be approved, so we can reject
>spam, which is why your message didn't show up right away.

Maybe I missed something up-front about getting moderated. Good precaution!

--
mjt

Stephen McDonald

unread,
Jul 2, 2012, 4:45:36 PM7/2/12
to mezzani...@googlegroups.com
Sorry I didn't fully understand what you were trying to do.

I can now see adding child pages under the blog page doesn't work - there are probably some issues related to the fact that the urlpatterns for the blog are separate from pages, but I'll take a look when I get a chance and see if I can allow for this case as well. In the mean time feel free to dive in yourself and see if you can work it out.

On Tue, Jul 3, 2012 at 6:39 AM, Markus Törnqvist <m...@nysv.org> wrote:
On Tue, Jul 03, 2012 at 06:30:54AM +1000, Stephen McDonald wrote:
>I can't replicate what it sounds like you're trying to do - in the admin I
>went into "Pages", added a new "Link" with the URL
>"/blog/category/django/", and it works fine.

On the top level, along with the main link to the blog, it works for me.

This site is in Finnish, but fwiw the top-level link is
/blog/category/pääkirjoitus and it filters just fine.


Did you try to add to the blog Page? From next to the arrows and X?

I got Title, and URL there as expected. Then Save and continue editing, and
URL is gone from the edit field(!!) I had typed in /blog/category/artikkeli

So I look at my menu in another tab and the entry is there. With the wrong
url. The url I ended up with is /blog/artikkeli :|

(Localized URLs would also be nice ;)

>PS new posters to the mailing list need to be approved, so we can reject
>spam, which is why your message didn't show up right away.

Maybe I missed something up-front about getting moderated. Good precaution!

--
mjt

Markus Törnqvist

unread,
Jul 3, 2012, 2:35:04 AM7/3/12
to mezzani...@googlegroups.com
On Tue, Jul 03, 2012 at 06:45:36AM +1000, Stephen McDonald wrote:
>Sorry I didn't fully understand what you were trying to do.

Explaining these things is best done by showing the code. When there is none,
I probably should have taken screenshots ;)

>I can now see adding child pages under the blog page doesn't work - there
>are probably some issues related to the fact that the urlpatterns for the
>blog are separate from pages, but I'll take a look when I get a chance and
>see if I can allow for this case as well. In the mean time feel free to
>dive in yourself and see if you can work it out.

I'm not sure I understand the design logic. Page should read like the ultimate
base class? Because Link inherits from Page, but Page.get_absolute_url() looks
at self.content_model to see if it's a link?

It's a bug, or mis-feature, in the slugification anyway. I was mistaken in
my previous message. The link I ended up with was /blog/artikkelit (not
/blog/artikkeli, but "artikkelit", which is the slugified title).

Nowhere (that I found yet) does the code talk about the URL field, which
just so disappears when I Save and Continue Editing.

Maybe I'll look into it later..

--
mjt

Markus Törnqvist

unread,
Jul 3, 2012, 3:52:05 AM7/3/12
to mezzani...@googlegroups.com
On Tue, Jul 03, 2012 at 09:35:04AM +0300, Markus T�rnqvist wrote:
>
>I'm not sure I understand the design logic. Page should read like the ultimate
>base class? Because Link inherits from Page, but Page.get_absolute_url() looks
>at self.content_model to see if it's a link?

Ok, this is because Mezzanine selects Page objects, probably getting the
inherited ones in the same query, and that's why it's hard to implement
this in the subclass. There should be a mechanism, though, because a
superclass can not and should not know about subclasses.

>It's a bug, or mis-feature, in the slugification anyway. I was mistaken in
>my previous message. The link I ended up with was /blog/artikkelit (not
>/blog/artikkeli, but "artikkelit", which is the slugified title).

As much as Mezzanine seems to rock, I unfortunately don't have the time
to fork and delve deep and fix and discuss changes and test I don't break
all the Mezzanine sites out there.

Instead I wrote another app, https://github.com/mjtorn/mezzanine-categorylink

It works like a charm here for exactly the purposes I want.

Had to screw around a bit with resolve anyway, but meh, it works and hopefully
helps someone else out there.

>Nowhere (that I found yet) does the code talk about the URL field, which
>just so disappears when I Save and Continue Editing.

No idea about the form really but doesn't even matter now.

--
mjt

Stephen McDonald

unread,
Jul 3, 2012, 6:52:52 AM7/3/12
to mezzani...@googlegroups.com
This is fixed here: https://github.com/stephenmcd/mezzanine/commit/c7a543237e7d2d40f234e19341be7a835c1ba3ef

It was due to some code added over two years ago to work around an issue that doesn't exist anymore, so I've just removed it. 

You should be able to add pages with custom URLs (such as links) as children of pages that point to other apps (such as the blog) and it'll work now = let us know how you go.

Markus Törnqvist

unread,
Jul 3, 2012, 6:57:11 AM7/3/12
to mezzani...@googlegroups.com
On Tue, Jul 03, 2012 at 08:52:52PM +1000, Stephen McDonald wrote:
>This is fixed here:
>https://github.com/stephenmcd/mezzanine/commit/c7a543237e7d2d40f234e19341be7a835c1ba3ef

Cool :)

>It was due to some code added over two years ago to work around an issue
>that doesn't exist anymore, so I've just removed it.

Yeah, these things happen.

>You should be able to add pages with custom URLs (such as links) as
>children of pages that point to other apps (such as the blog) and it'll
>work now = let us know how you go.

I just pushed the site out to content management, with my app taking care of
that... So let's see when I get around to testing it, probably when a new
major release comes out.

But I also kind of like the approach of having links for blog categories with
a drop-down; should make life easier for the regular content administrator as
well.

Thanks!

--
mjt

Reply all
Reply to author
Forward
0 new messages