recettes/templates/index.html

37 lines
963 B
HTML
Raw Normal View History

2018-05-26 16:01:04 +02:00
{% extends 'base.html' %}
2018-10-14 19:59:04 +02:00
{% load thumbnail %}
2018-10-28 12:03:29 +01:00
{% block title %}Recherche{% endblock %}
2018-10-14 19:59:04 +02:00
{% block extrahead %}
<style>
ul.results { list-style-type: none; padding: 0; }
ul.results li { margin: 0; padding: 2px; }
ul.results li, ul.results li * { vertical-align: middle; }
ul.results li:nth-child(odd) { background-color: #eee; }
input#id_text { padding: 10px 0; }
form#search-form p { display: inline-block; margin-right: 1em; }
</style>
{% endblock %}
2018-05-26 16:01:04 +02:00
{% block content %}
<h1>Recettes</h1>
2018-10-14 19:59:04 +02:00
<form id="search-form" method="POST">{% csrf_token %}
2018-05-26 16:01:04 +02:00
{{ form.as_p }}
2018-10-14 19:59:04 +02:00
<div><button>Rechercher</button></div>
2018-05-26 16:01:04 +02:00
</form>
2018-05-27 11:22:55 +02:00
{% if num_results is not None %}
<div class="results">{{ num_results }} résultat(s)</div>
{% endif %}
2018-10-14 19:59:04 +02:00
<ul class="results">
2018-05-26 16:01:04 +02:00
{% for recette in recettes %}
2018-10-14 19:59:04 +02:00
<li>
<a href="{{ recette.get_absolute_url }}">{{ recette.nom }}</a>
<img src="{{ recette.photo|thumbnail_url:'thumbnail' }}">
</li>
2018-05-26 16:01:04 +02:00
{% endfor %}
</ul>
{% endblock %}