I've set up custom 403, 404, and 500 pages as flatpages. Obviously, I don't want these to show up in my navigation menu. Unfortunately, nothing I seem to do can get rid of them.
I want something like:
{% for page in flatpages %}
{% if page.url != "/403/" and page.url != "/404/" and page.url != "/500/" %}
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
{% endif %}
{% endfor %}
...but that doesn't seem to work. In fact, nothing seems to work. I've tried
{% if "error" not in page.url %}
(which would theoretically empty out my menu bar, since I haven't set ANY of the flatpage URLs to include 'error'), but that doesn't work either. Every time I reload the page (even after running manage.py collectstatic
and sudo pkill python
), all the flatpages are still there. Am I missing something? I don't want to do something like
{% if '/page/' in page.url %}
for each and every one of my flatpages, since that doesn't seem in keeping with DRY (and would be a pain, besides.)
Any suggestions?