diff --git a/apache/000-default.conf b/apache/000-default.conf index bf85cc0..b9d347e 100644 --- a/apache/000-default.conf +++ b/apache/000-default.conf @@ -13,7 +13,7 @@ WSGIPythonPath /vagrant/django/didgeridoo/ ServerAdmin webmaster@localhost - Alias /media/ /vagrant/django/didgeridoo/media/ + Alias /media/ /srv/media/ Alias /static/ /vagrant/django/didgeridoo/static/ @@ -23,7 +23,7 @@ WSGIPythonPath /vagrant/django/didgeridoo/ - + Require all granted diff --git a/django/didgeridoo/webshop/templates/webshop/article_details.html b/django/didgeridoo/webshop/templates/webshop/article_details.html index e580fdc..3c1c3bb 100644 --- a/django/didgeridoo/webshop/templates/webshop/article_details.html +++ b/django/didgeridoo/webshop/templates/webshop/article_details.html @@ -6,4 +6,7 @@

Stock: {{ article.stock }}

Status: {{ article.status}}

Price: {{ article.price_in_chf }}

+ {% for picture in picture_list %} +

+ {% endfor %} {% endblock %} diff --git a/django/didgeridoo/webshop/views.py b/django/didgeridoo/webshop/views.py index 499c261..7d921a6 100644 --- a/django/didgeridoo/webshop/views.py +++ b/django/didgeridoo/webshop/views.py @@ -3,7 +3,12 @@ from django.shortcuts import get_object_or_404, render from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm -from webshop.models import Article, Category, ArticleStatus, Person, City +from webshop.models import (Article, + Category, + ArticleStatus, + Person, + City, + Picture) from webshop.forms import RegistrationForm # Create your views here. @@ -36,8 +41,10 @@ def articles_in_category(request, category_id): def article_details(request, article_id): article = get_object_or_404(Article, pk=article_id) + picture_list = Picture.objects.filter(article=article_id) return render(request, 'webshop/article_details.html', - {'article': article}) + {'article': article, + 'picture_list': picture_list}) @login_required