Adjusted delete view
This commit is contained in:
parent
121b99730d
commit
675cdc5721
@ -4,7 +4,7 @@
|
|||||||
''' Django views. '''
|
''' Django views. '''
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views.generic.edit import CreateView, UpdateView
|
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
|
||||||
@ -96,14 +96,10 @@ class PlaceCreateView(View):
|
|||||||
)
|
)
|
||||||
place_image.save()
|
place_image.save()
|
||||||
|
|
||||||
class PlaceDeleteView(View):
|
class PlaceDeleteView(DeleteView):
|
||||||
#template_name = 'delete_place.html'
|
template_name = 'delete_place.html'
|
||||||
#model = Place
|
model = Place
|
||||||
#form_class = PlaceDeleteForm
|
form_class = PlaceDeleteForm
|
||||||
|
|
||||||
def get(self, request, pk, *args, **kwargs):
|
def get_success_url(self):
|
||||||
place = Place.objects.get(pk=pk)
|
return reverse_lazy('place_list')
|
||||||
place_delete_form = PlaceDeleteForm()
|
|
||||||
|
|
||||||
context = {'place': place, 'form': place_delete_form}
|
|
||||||
return render(request, 'delete_place.html', context)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user