Dedicated Home View
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
from django.urls import path
 | 
			
		||||
from .views import (
 | 
			
		||||
    hello_world,
 | 
			
		||||
	HomeView, 
 | 
			
		||||
    place_detail_view, 
 | 
			
		||||
    place_list_view, 
 | 
			
		||||
    SignUpView, 
 | 
			
		||||
@@ -10,6 +11,7 @@ from .views import (
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    path('hello_world/', hello_world), # You know what this is :P
 | 
			
		||||
	path('', HomeView.as_view(), name='home'),
 | 
			
		||||
    path('signup/', SignUpView.as_view(), name='signup'),
 | 
			
		||||
    path('place/<int:pk>/', place_detail_view, name='place_detail'),
 | 
			
		||||
    path('place/create/', PlaceCreateView.as_view(), name='place_create'),
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,16 @@ def place_detail_view(request, pk):
 | 
			
		||||
def hello_world(request):
 | 
			
		||||
    return render(request, 'hello_world.html', {'text':'Hello World!'})
 | 
			
		||||
 | 
			
		||||
class HomeView(View):
 | 
			
		||||
	def get(self, request, *args, **kwargs):
 | 
			
		||||
		place_list = Place.objects.all().order_by('submitted_when')[:10]
 | 
			
		||||
		print(place_list)
 | 
			
		||||
		context = {
 | 
			
		||||
			'place_list': place_list
 | 
			
		||||
		}
 | 
			
		||||
		return render(request, 'home.html', context)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class PlaceUpdateView(UpdateView):
 | 
			
		||||
    template_name = 'update_place.html'
 | 
			
		||||
    model = Place
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user