Fix #17 and change food images to thumbs
This commit is contained in:
parent
31e636abb8
commit
16dbf49d6e
18
ofu_app/apps/food/migrations/0008_auto_20180201_1018.py
Normal file
18
ofu_app/apps/food/migrations/0008_auto_20180201_1018.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.0.1 on 2018-02-01 10:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('food', '0007_auto_20180117_0137'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='singlefood',
|
||||
name='allergens',
|
||||
field=models.ManyToManyField(blank=True, to='food.Allergene'),
|
||||
),
|
||||
]
|
||||
@ -60,11 +60,12 @@ def account_activation_sent(request):
|
||||
|
||||
|
||||
def account_view(request):
|
||||
print("There it is ---------------------------------------------------------------------")
|
||||
if request.user.is_authenticated:
|
||||
user = request.user
|
||||
|
||||
food_ratings = UserRating.objects.filter(user=user).order_by('food__name')
|
||||
food_images = UserFoodImage.objects.filter(user=user)
|
||||
food_images = UserFoodImage.objects.filter(user=user.id)
|
||||
print(food_images)
|
||||
|
||||
return render(request, 'registration/account_view.jinja',
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
{% if single_food.image %}
|
||||
<a href="{{ single_food.image.image.url }}" data-lightbox="{{ title }}"
|
||||
data-title="{{ single_food.name }}">
|
||||
<img src="{{ single_food.image.image.url }}" class="media-object" alt="Bild" width="80px">
|
||||
<img src="{{ single_food.image.thumb.url }}" class="media-object" alt="Bild" width="80px">
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{{ static('img/food/default.jpg') }}" data-lightbox="{{ title }}"
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-4 p-3 bg-light text-dark">
|
||||
<p>{{ image.food.name }}</p>
|
||||
<div class="thumbnail">
|
||||
<a href="{{ image.image.url }}">
|
||||
<img src="{{ image.image.url }}" alt="Lights" style="width:100%">
|
||||
<a href="{{ image.image.image.url }}">
|
||||
<img src="{{ image.image.thumb.url }}" alt="Lights" style="width:100%">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user