-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_link will always return absolute urls instead of relative urls, making it hard to author content/test out locally #200
Comments
@silkentrance Yes, I'd agree that going through the placeholder to get a site_id in order to find the correct Site object isn't the best way to go about things. However I don't think you can simplify |
@marksweb considering that pages are always created by going through the API then the existence of the node foreign key is ensured, even more so since the page model does not declare it to be nullable, so it is a mandatory property of the page. Therefore I tend to believe that the presented code is correct and should work under all circumstances. Yet, looking at djangocms-link/djangocms_link/models.py Line 162 in 1d0417e
I am not so sure anymore. I will check the multiple usage scenarios and see what I can find... |
@silkentrance Actually, I think you're right. Yesterday I was thinking back to times I've built things for menus and it's the node that you can't guarantee is attached to a page, but this is the other side of that 🤦 By the way, I'm not sure if you're a slack user, but if you are it might be worth joining our slack django-cms.org/slack |
I have played around with links in static placeholders, links in modules, links linking to pages from a different site than the current one. As of now, everything seems to be working just fine. |
To follow up on #165
I tend to believe that the placeholder cms_page is redundant as Site.objects.get_current() will already return the correct site. And, considering that any placeholder.page.site is always the current site, when available, the code could be reduced to just
I have implemented this locally and it works like a charm, unless I missed some very specific detail 😄
I can provide you with a PR for this if you want.
The text was updated successfully, but these errors were encountered: