Added places list view.
This commit is contained in:
		@@ -1,7 +1,8 @@
 | 
			
		||||
from django.urls import path
 | 
			
		||||
from .views import hello_world, place_detail_view
 | 
			
		||||
from .views import hello_world, place_detail_view, place_list_view
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    path('hello_world/', hello_world),
 | 
			
		||||
    path('place/<int:pk>/', place_detail_view)
 | 
			
		||||
    path('place/<int:pk>/', place_detail_view),
 | 
			
		||||
    path('places/', place_list_view)
 | 
			
		||||
]
 | 
			
		||||
@@ -3,9 +3,11 @@ from .models import Place
 | 
			
		||||
 | 
			
		||||
# Create your views here.
 | 
			
		||||
 | 
			
		||||
def place_list_view(request,):
 | 
			
		||||
    return render(request, 'placeList.html', {'place':Place.objects.all()})
 | 
			
		||||
 | 
			
		||||
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)})
 | 
			
		||||
 | 
			
		||||
def hello_world(request):
 | 
			
		||||
    return render(request, 'hello_world.html', {'text':'Hello World!'})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user