Compare commits
2 Commits
5c449851ac
...
3e330f88a5
Author | SHA1 | Date |
---|---|---|
Michael Vignotto | 3e330f88a5 | |
Michael Vignotto | 7fc3f8e14d |
Binary file not shown.
|
@ -12,9 +12,9 @@
|
|||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h1 class="text-center text-muted">In totale nel nostro Salone Bar abbiamo trovato {{ cocktail.count }} cocktails {% if cocktail.count == 1 %} che corrisponde {% else %} che corrispondono {% endif %} alla tua ricerca <i class="fas fa-cocktail"></i> </h1>
|
||||
{% for cocktails in cocktail %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for cocktails in cocktail %}
|
||||
<!-- {{ cocktail.ingredienti.all }}
|
||||
{{ cocktail.nome_cocktail }} -->
|
||||
{% if forloop.first %} <div class="row"> {% endif %}
|
||||
|
|
|
@ -14,15 +14,16 @@ COCKTAIL | {{ cocktail.nome_cocktail }}
|
|||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card mt-3">
|
||||
<div class="card my-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title text-center text-on-header">{{ cocktail.nome_cocktail }}</h3>
|
||||
</div>
|
||||
<div class="row no-gutters">
|
||||
<div class="col-md-5">
|
||||
<img src="{{ cocktail.immagine_cocktail.url }}" class="card-img h-100" alt="{{ cocktail.nome_cocktail }}">
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="col-md-12">
|
||||
<img src="{{ cocktail.immagine_cocktail.url }}" class="card-img img-fluid" alt="{{ cocktail.nome_cocktail }}">
|
||||
<div class="text_on_image">{{ cocktail.nome_cocktail }}</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card-body">
|
||||
<h5 class="card-text text-center text-on-header">INGREDIENTI : </h5>
|
||||
<hr>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.shortcuts import render,get_object_or_404,redirect
|
||||
from .models import Cocktail,Ingredienti,Strumenti,Bicchieri
|
||||
import random
|
||||
import time
|
||||
# Create your views here.
|
||||
|
||||
|
||||
|
@ -63,14 +62,12 @@ def bicchieri_cocktail(request):
|
|||
def cerca(request):
|
||||
if "q" in request.GET:
|
||||
querystring = request.GET.get("q")
|
||||
if len(querystring) == 0:
|
||||
if len(querystring) < 3:
|
||||
return redirect("cerca")
|
||||
all_ingredients = Cocktail.objects.all()
|
||||
searching_ingred = Cocktail.objects.none()
|
||||
for one_ingredient in querystring.split(","):
|
||||
print(one_ingredient)
|
||||
searching_ingred = searching_ingred.union(searching_ingred, all_ingredients.filter(ingredienti__ingrediente__icontains=one_ingredient))
|
||||
print(searching_ingred)
|
||||
# ingrediente = Cocktail.objects.filter(ingredienti__ingrediente__icontains=querystring).order_by("-nome_cocktail")
|
||||
cocktail = Cocktail.objects.filter(nome_cocktail__icontains=querystring).order_by("-nome_cocktail")
|
||||
context = {"querystring":querystring,"cocktail":cocktail,"ingrediente":searching_ingred}
|
||||
|
|
|
@ -10,3 +10,13 @@
|
|||
font-family: 'Indie Flower', cursive;
|
||||
font-size: 25px;
|
||||
}
|
||||
.text_on_image{
|
||||
color:white;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-transform: uppercase;
|
||||
font-size: 2.5em;
|
||||
font-family: 'Faster One', cursive;
|
||||
}
|
|
@ -47,4 +47,14 @@ a:hover{
|
|||
font-size: 1.5em;
|
||||
text-transform: uppercase;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.img-fluid {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media screen and (max-width:600px){
|
||||
h1 {
|
||||
font-size: 1.5rem!important;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue