Skip to content
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

Cant use pages_navigation outside of cms pages #134

Closed
rosscdh opened this issue Jan 24, 2016 · 2 comments
Closed

Cant use pages_navigation outside of cms pages #134

rosscdh opened this issue Jan 24, 2016 · 2 comments

Comments

@rosscdh
Copy link

rosscdh commented Jan 24, 2016

Hi there, great cms variation btw. Keen to use it.

I have a problem where; when outside of any cms page, I cannot use the pages_navigation templatetag

is this desired behaviour? should I write a custom template tag to work around it or have a missed something?

@batiste
Copy link
Owner

batiste commented Jan 25, 2016

Have you used the {% load_pages %} template tag inside your template?
This is needed so some fundamental variables are loaded in the current context:

https://github.com/batiste/django-page-cms/blob/master/pages/templatetags/pages_tags.py#L358

In short pages_navigation and current_page are the 2 context variables that are expected to be present in the context if you want to use navigation template tag. You can also decide to set those variables by yourself if you need to.

@rosscdh
Copy link
Author

rosscdh commented Jan 25, 2016

Ah Morning sorry I just noticed this message.

I found exactly that looking through the template_tags code, fantastic :) thanks for the tip!

            {% load_pages %}
            {% for page in pages_navigation %}

works a charm :)

@rosscdh rosscdh closed this as completed Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants