Compare commits
No commits in common. "3e330f88a5550a9732bdd809006ff46b257bb770" and "5c449851aca4a8bf1d716c4e6444ca0ad1e5bacb" have entirely different histories.
3e330f88a5
...
5c449851ac
Binary file not shown.
|
@ -12,9 +12,9 @@
|
||||||
<div class="card mt-3">
|
<div class="card mt-3">
|
||||||
<div class="card-header">
|
<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>
|
<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>
|
||||||
</div>
|
|
||||||
{% for cocktails in cocktail %}
|
|
||||||
<!-- {{ cocktail.ingredienti.all }}
|
<!-- {{ cocktail.ingredienti.all }}
|
||||||
{{ cocktail.nome_cocktail }} -->
|
{{ cocktail.nome_cocktail }} -->
|
||||||
{% if forloop.first %} <div class="row"> {% endif %}
|
{% if forloop.first %} <div class="row"> {% endif %}
|
||||||
|
|
|
@ -14,16 +14,15 @@ COCKTAIL | {{ cocktail.nome_cocktail }}
|
||||||
{% endblock title %}
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="card my-3">
|
<div class="card mt-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title text-center text-on-header">{{ cocktail.nome_cocktail }}</h3>
|
<h3 class="card-title text-center text-on-header">{{ cocktail.nome_cocktail }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="row no-gutters">
|
<div class="row no-gutters">
|
||||||
<div class="col-md-12">
|
<div class="col-md-5">
|
||||||
<img src="{{ cocktail.immagine_cocktail.url }}" class="card-img img-fluid" alt="{{ cocktail.nome_cocktail }}">
|
<img src="{{ cocktail.immagine_cocktail.url }}" class="card-img h-100" alt="{{ cocktail.nome_cocktail }}">
|
||||||
<div class="text_on_image">{{ cocktail.nome_cocktail }}</div>
|
</div>
|
||||||
</div>
|
<div class="col-md-7">
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-text text-center text-on-header">INGREDIENTI : </h5>
|
<h5 class="card-text text-center text-on-header">INGREDIENTI : </h5>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from django.shortcuts import render,get_object_or_404,redirect
|
from django.shortcuts import render,get_object_or_404,redirect
|
||||||
from .models import Cocktail,Ingredienti,Strumenti,Bicchieri
|
from .models import Cocktail,Ingredienti,Strumenti,Bicchieri
|
||||||
import random
|
import random
|
||||||
|
import time
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,12 +63,14 @@ def bicchieri_cocktail(request):
|
||||||
def cerca(request):
|
def cerca(request):
|
||||||
if "q" in request.GET:
|
if "q" in request.GET:
|
||||||
querystring = request.GET.get("q")
|
querystring = request.GET.get("q")
|
||||||
if len(querystring) < 3:
|
if len(querystring) == 0:
|
||||||
return redirect("cerca")
|
return redirect("cerca")
|
||||||
all_ingredients = Cocktail.objects.all()
|
all_ingredients = Cocktail.objects.all()
|
||||||
searching_ingred = Cocktail.objects.none()
|
searching_ingred = Cocktail.objects.none()
|
||||||
for one_ingredient in querystring.split(","):
|
for one_ingredient in querystring.split(","):
|
||||||
|
print(one_ingredient)
|
||||||
searching_ingred = searching_ingred.union(searching_ingred, all_ingredients.filter(ingredienti__ingrediente__icontains=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")
|
# ingrediente = Cocktail.objects.filter(ingredienti__ingrediente__icontains=querystring).order_by("-nome_cocktail")
|
||||||
cocktail = Cocktail.objects.filter(nome_cocktail__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}
|
context = {"querystring":querystring,"cocktail":cocktail,"ingrediente":searching_ingred}
|
||||||
|
|
|
@ -10,13 +10,3 @@
|
||||||
font-family: 'Indie Flower', cursive;
|
font-family: 'Indie Flower', cursive;
|
||||||
font-size: 25px;
|
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;
|
|
||||||
}
|
|
|
@ -48,13 +48,3 @@ a:hover{
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-fluid {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width:600px){
|
|
||||||
h1 {
|
|
||||||
font-size: 1.5rem!important;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue