mezzanine icon indicating copy to clipboard operation
mezzanine copied to clipboard

page.link object not taking into account SITE_PREFIX when rendered in menus

Open PBibiloni opened this issue 7 years ago • 1 comments

Hi,

When the get_absolute_url() method is executed on (rich text) pages, it automatically adds the SITE_PREFIX if any. However, the behaviour for links is different and does not take it into account. I think that mezzanine.pages.models should read (only excerpt of interest):

        if self.content_model == "link":
            # My addition is next two lines:
            if settings.SITE_PREFIX:
                slug = settings.SITE_PREFIX + '/' + slug
            # Ensure the URL is absolute.
            slug = urljoin('/' , slug)
            return slug

I've never contributed to a project (so I'm not sure if a pull request or something else is needed), but if there's something I can do to ease your work just drop me a line.

Pedro.

PBibiloni avatar Oct 20 '18 16:10 PBibiloni

Hi, thanks for this it makes sense - a pull request would be great if you can do that.

stephenmcd avatar Oct 20 '18 23:10 stephenmcd