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;
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>
<div class="column-row">
<div class="column-sm-1 column-md-2 column-lg-3">
<div class="unbreakable">
<div class="unbreakable carte-inverted">
<h3>Pressions du moment</h3>
<ul class="carte">
{% for article in pressions.articles.all %}
{% if article.is_sold %}
{% for article in pressions %}
<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>
{% endif %}
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% for category in categories %}
<div class="unbreakable">
<h3>{{ category.name }}</h3>
<ul class="carte">
{% for article in category.articles.all %}
{% if article.is_sold %}
<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>
{% for article in articles %}
{% ifchanged article.category %}
{% if not forloop.first %}
</ul>
</div><!-- endblock unbreakable -->
{% endif %}
<div class="unbreakable">
<h3>{{ article.category.name }}</h3>
<ul class="carte">
{% endifchanged %}
<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 %}
{% endfor %}
</ul>
</div><!-- endblock unbreakable -->
{% endfor %}
</div>
</div>

View file

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