Carte done.

This commit is contained in:
Qwann 2017-01-26 17:19:42 +01:00
parent a63966b2f6
commit 3ca38bd8e9
3 changed files with 33 additions and 21 deletions

View file

@ -41,3 +41,10 @@ li.carte-line {
padding-left: 4px; padding-left: 4px;
position: relative; position: relative;
} }
.unbreakable.carte-inverted .carte-ukf,
.unbreakable.carte-inverted .carte-label,
.unbreakable.carte-inverted {
background: #FFDBC7;
}

View file

@ -28,35 +28,37 @@
<h2>Carte</h2> <h2>Carte</h2>
<div class="column-row"> <div class="column-row">
<div class="column-sm-1 column-md-2 column-lg-3"> <div class="column-sm-1 column-md-2 column-lg-3">
<div class="unbreakable"> <div class="unbreakable carte-inverted">
<h3>Pressions du moment</h3> <h3>Pressions du moment</h3>
<ul class="carte"> <ul class="carte">
{% for article in pressions.articles.all %} {% for article in pressions %}
{% if article.is_sold %}
<li class="carte-line"> <li class="carte-line">
<div class="filler"></div> <div class="filler"></div>
<span class="carte-label">{{ article.name }}</span> <span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span> <span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li> </li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div><!-- endblock unbreakable --> </div><!-- endblock unbreakable -->
{% for category in categories %} {% for article in articles %}
<div class="unbreakable"> {% ifchanged article.category %}
<h3>{{ category.name }}</h3> {% if not forloop.first %}
<ul class="carte"> </ul>
{% for article in category.articles.all %} </div><!-- endblock unbreakable -->
{% if article.is_sold %} {% endif %}
<li class="carte-line"> <div class="unbreakable">
<div class="filler"></div> <h3>{{ article.category.name }}</h3>
<span class="carte-label">{{ article.name }}</span> <ul class="carte">
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span> {% endifchanged %}
</li> <li class="carte-line">
<div class="filler"></div>
<span class="carte-label">{{ article.name }}</span>
<span class="carte-ukf">{{ article.price | ukf:False}} UKF</span>
</li>
{% if foorloop.last %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %} {% endif %}
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

View file

@ -48,9 +48,12 @@ class Home(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(TemplateView, self).get_context_data(**kwargs) context = super(TemplateView, self).get_context_data(**kwargs)
categories = ArticleCategory.objects.all() articles = Article.objects.all()
context['pressions'] = categories.get(name='Pression') context['pressions'] = (articles.filter(category__name='Pression')
context['categories'] = categories.exclude(name='Pression') .filter(is_sold=True))
context['articles'] = (articles.exclude(category__name='Pression')
.filter(is_sold=True)
.order_by('category'))
return context return context
@method_decorator(login_required) @method_decorator(login_required)