# -*- coding: utf-8 -*-
from mezzanine.pages.models import Page
-from django import template
+from mezzanine.template import Library
+from mezzanine_agenda.models import Event
+from festival.models import Artist
-register = template.Library()
+register = Library()
-@register.simple_tag
-def edito():
- qs = Page.objects.filter(title="Edito")
+@register.as_tag
+def festival_edito(*args):
+ qs = Page.objects.filter(slug="edito")
if qs:
- return qs[0].content
+ return qs[0].get_content_model()
else:
- return ''
+ return None
+
+@register.as_tag
+def festival_event_featured(*args):
+ models = [Event,]
+ featured = []
+ for model in models:
+ objs = model.objects.filter(featured=True)
+ for obj in objs:
+ if hasattr(obj, 'featured_image_header'):
+ featured.append(obj)
+ return featured
# one homepage pattern, so if you use a different one, comment this
# one out.
+ url("^styles/$", direct_to_template, {"template": "styles.html"}, name="styles"),
url("^$", direct_to_template, {"template": "index.html"}, name="home"),
# HOMEPAGE AS AN EDITABLE PAGE IN THE PAGE TREE
<!doctype html>
<html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
-{% load pages_tags mezzanine_tags i18n staticfiles keyword_tags event_tags %}
+{% load i18n pages_tags mezzanine_tags staticfiles keyword_tags event_tags festival_tags %}
{% get_language_info_list for LANGUAGES as languages %}
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
</div>
</div>
-
{% if on_home %}
<div class="hero__slider">
<ul id="lightSlider">
- <li class="hero__slider__item" style="background-image: url(https://source.unsplash.com/IaA_5KNVAR4/1920x500);">
- <div class="container">
- <button>Content here !</button>
- </div>
- </li>
- <li class="hero__slider__item" style="background-image: url(https://source.unsplash.com/OUgLA2unwtg/1920x500);">
- <div class="container">
- <button>Another content here !</button>
- </div>
- </li>
+ {% festival_event_featured as events %}
+ {% for event in events %}
+ <li class="hero__slider__item" style="background-image: url({{ event.featured_image_header.url }});">
+ <div class="container">
+ <button>Content here !</button>
+ </div>
+ </li>
+ {% endfor %}
</ul>
</div>
{% endif %}
{% load i18n festival_tags %}
{% block meta_title %}{% trans "Home" %}{% endblock %}
-{% block title %}{% trans "Home" %}{% endblock %}
{% block breadcrumb_menu %}
<li class="active">{% trans "Home" %}</li>
{% endblock %}
-{% block main %}
-<h2>{% trans "Edito" %}</h2>
-{% edito %}
+{% block title %}{% trans "Edito" %}{% endblock %}
-<hr>
-{% include "includes/html_styleguide.html" %}
+{% block main %}
+{% festival_edito as edito %}
+{{ edito.content|safe }}
{% endblock %}
{% spaceless %}
{% if page_branch_in_menu %}
-
-{% if branch_level == 0 %}
-<ul class="menu">
- {% for page in page_branch %}
- {% if not has_home and page.is_primary and forloop.first %}
- <li class="menu__item {% if on_home %}active{% endif %}">
- <a href="{% url "home" %}" class="menu__item__link">{% trans "Home" %}</a>
- </li>
- {% endif %}
- {% if page.in_menu %}
- <li class="menu__item {% if page.has_children_in_menu %}dropdown{% endif %}
- {% if page.is_current_or_ascendant %}active{% endif %}"
- id="{{ page.html_id }}">
- <a href="{{ page.get_absolute_url }}"
- class="menu__item__link "
- {% if page.has_children_in_menu %}
- data-toggle="dropdown"
- {% endif %}>
- {{ page.title }}
- {% if page.has_children_in_menu %}
- <b class="caret"></b>
+ {% if branch_level == 0 %}
+ <ul class="menu">
+ {% for page in page_branch %}
+ {% if not has_home and page.is_primary and forloop.first %}
+ <li class="menu__item{% if on_home %} active{% endif %}">
+ <a href="{% url "home" %}" class="menu__item__link">{% trans "Home" %}</a>
+ </li>
{% endif %}
- </a>
- {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
- </li>
- {% endif %}
- {% endfor %}
-</ul>
-{% else %}
-<ul class="dropdown-menu">
- {% for page in page_branch %}
- {% if page.in_menu %}
- <li class="{% if page.has_children_in_menu %}dropdown-submenu{% endif %}
- {% if page.is_current_or_ascendant %}active{% endif %}"
- id="{{ page.html_id }}">
- <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
- {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
- </li>
+ {% if page.in_menu %}
+ <li class="menu__item{% if page.has_children_in_menu %}dropdown{% endif %}{% if page.is_current_or_ascendant %} active{% endif %}" id="{{ page.html_id }}">
+ <a href="{{ page.get_absolute_url }}" class="menu__item__link" {% if page.has_children_in_menu %} data-toggle="dropdown"{% endif %}>{{ page.title }}{% if page.has_children_in_menu %}<b class="caret"></b>{% endif %}</a>
+ {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+ </li>
+ {% endif %}
+ {% endfor %}
+ </ul>
+ {% else %}
+ <ul class="dropdown-menu">
+ {% for page in page_branch %}
+ {% if page.in_menu %}
+ <li class="{% if page.has_children_in_menu %}dropdown-submenu{% endif %}{% if page.is_current_or_ascendant %} active{% endif %}"id="{{ page.html_id }}">
+ <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+ {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+ </li>
+ {% endif %}
+ {% endfor %}
+ </ul>
{% endif %}
- {% endfor %}
-</ul>
-{% endif %}
-
{% endif %}
{% endspaceless %}
--- /dev/null
+{% extends "base.html" %}
+{% load i18n festival_tags %}
+
+{% block meta_title %}{% trans "Styles" %}{% endblock %}
+
+{% block title %}{% trans "Styles" %}{% endblock %}
+
+{% block main %}
+{% include "includes/html_styleguide.html" %}
+{% endblock %}