Open GoogleCodeExporter opened 9 years ago
I created a fix for your issue:
http://github.com/batiste/django-page-cms/commit/0f6e7de935d9f2cddf1980b56eb9e17
fc0a8827d
Could check if it works?
Original comment by batiste....@gmail.com
on 13 Sep 2010 at 10:34
Unfortunately still not work.
Relevant sections from settings.py
DEFAULT_LANGUAGE = 'en'
PAGE_LANGUAGES = (
('sk', gettext_noop('Slovak')),
('en', gettext_noop('English')),
)
PAGE_USE_LANGUAGE_PREFIX = True
Relevant sections from urls.py:
urlpatterns += patterns('',
(r'^authority/', include('authority.urls')),
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^search/', include('haystack.urls')),
(r'^', include('pages.urls')),
)
Template code in pages/templates/search/search.html
{% for result in page.object_list %}
<a href="{{ result.object.get_url_path }}">{{ result.object.title }}</a>
{% endfor %}
Patch was applied correctly.
What is happening now:
as default language is set to 'en' search is performed in English. Every result
now have language prefix '/en/'.
I think this is because in search logic (not sure if Haystack or in Pages) do
not push language parameter.
In get_url_path we have this:
if not language:
language = settings.PAGE_DEFAULT_LANGUAGE
url = reverse('pages-root')
if settings.PAGE_USE_LANGUAGE_PREFIX:
url += str(language) + '/'
return url + self.get_complete_slug(language)
We are not getting language parameter so pages will apply 'if not language'
condition.
Original comment by jozef.ma...@gmail.com
on 13 Sep 2010 at 1:16
The issue is that {{ result.object.get_url_path }} doesn't not pass any
language parameter.
If you want the current language passed there is a special tag provided by the
CMS:
{% show_absolute_url page_object %}...
More infos here:
http://packages.python.org/django-page-cms/display-content.html#show-absolute-ur
l
Original comment by batiste....@gmail.com
on 24 Sep 2010 at 8:14
Original issue reported on code.google.com by
jozef.ma...@gmail.com
on 24 Jul 2010 at 12:39