recettes/templates/index.html

57 lines
1.3 KiB
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 %}
{% block title %}Recherche de recettes{% endblock %}
2018-10-28 12:03:29 +01:00
2018-10-14 19:59:04 +02:00
{% block extrahead %}
<style>
ul { list-style-type: none; padding: 0; }
2021-07-03 21:09:00 +02:00
a { text-decoration: none; }
input#id_text { padding: 10px 0; }
form#search-form p, form#search-form ul {
display: inline-block;
margin-right: 1em;
vertical-align: top;
}
2021-07-03 21:09:00 +02:00
ul.results { display: flex; flex-wrap: wrap; }
ul.results li {
width: 15em;
padding: 5px 0;
margin: 1.5em;
text-align: center;
border-radius: 8px;
border: 1px solid #ddd;
font-size: 108%;
font-weight: bold;
font-family: sans-serif;
}
ul.results li:hover { background-color: #ddd; }
ul.results li img { width: 100%; }
2018-10-14 19:59:04 +02:00
</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 }}
2020-09-11 18:35:57 +02:00
<div><button type="submit">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>
2021-07-03 21:09:00 +02:00
<a href="{{ recette.get_absolute_url }}">
{{ recette.nom }}
<img src="{{ recette.photo|thumbnail_url:'thumbnail' }}">
<img src="{{ recette.photo.url }}">
</a>
2018-10-14 19:59:04 +02:00
</li>
2018-05-26 16:01:04 +02:00
{% endfor %}
</ul>
{% endblock %}