Fixed List View

This commit is contained in:
Marcus Scholz 2020-07-26 23:34:03 +02:00
parent af8cfe42e6
commit e55716ec8b
3 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<ul class="LP-Place__List"> <ul class="LP-Place__List">
{% for place in place_list %} {% for place in place_list %}
<li class="LP-Place__Item"> <li class="LP-Place__Item">
<a href="{% url 'place_detail' pk=place.id %}" class="LP-Link"> <a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
<article class="LP-Place"> <article class="LP-Place">
<img class="LP-Place__Image" src="/images/photo_2020-04-09_18-27-13.jpg" /> <img class="LP-Place__Image" src="/images/photo_2020-04-09_18-27-13.jpg" />
<div class="LP-Place__Assets"> <div class="LP-Place__Assets">

View File

@ -3,6 +3,6 @@ from .views import hello_world, place_detail_view, place_list_view
urlpatterns = [ urlpatterns = [
path('hello_world/', hello_world), path('hello_world/', hello_world),
path('place/<int:pk>/', place_detail_view), path('place/<int:pk>/', place_detail_view, name='place_detail'),
path('places/', place_list_view) path('places/', place_list_view)
] ]

View File

@ -4,7 +4,7 @@ from .models import Place
# Create your views here. # Create your views here.
def place_list_view(request,): def place_list_view(request,):
return render(request, 'placeList.html', {'place':Place.objects.all()}) return render(request, 'placeList.html', {'place_list':Place.objects.all()})
def place_detail_view(request, pk): def place_detail_view(request, pk):
return render(request, 'placeOverview.html', {'place':Place.objects.get(pk=pk)}) return render(request, 'placeOverview.html', {'place':Place.objects.get(pk=pk)})