diff --git a/lostplaces/lostplaces_app/views.py b/lostplaces/lostplaces_app/views.py index bc8a19e..319c665 100644 --- a/lostplaces/lostplaces_app/views.py +++ b/lostplaces/lostplaces_app/views.py @@ -4,10 +4,9 @@ ''' Django views. ''' from django.shortcuts import render, redirect, get_object_or_404 from django.urls import reverse_lazy -from django.views.generic.edit import CreateView +from django.views.generic.edit import CreateView, UpdateView from django.views import View from django.http import Http404 -from django.views.generic.edit import UpdateView from .forms import ( ExplorerCreationForm, @@ -97,12 +96,14 @@ class PlaceCreateView(View): place_image.save() class PlaceDeleteView(View): - template_name = 'delete_place.html' - model = Place - form_class = PlaceDeleteForm + #template_name = 'delete_place.html' + #model = Place + #form_class = PlaceDeleteForm - def get(self, request, *args, **kwargs): + def get(self, request, pk, *args, **kwargs): + place = Place(pk=pk) + print(pk, place.name) place_delete_form = PlaceDeleteForm() - context = {'place_form': place_delete_form} - return render(request, 'create_place.html', context) + context = {'place': place, 'form': place_delete_form} + return render(request, 'delete_place.html', context)