Dyfunct, but non-breaking WIP commit. :P
This commit is contained in:
parent
565c58019b
commit
172e462d1d
@ -48,3 +48,8 @@ class PlaceImageCreateForm(forms.ModelForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.fields['filename'].required = False
|
||||
|
||||
class PlaceDeleteForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Place
|
||||
fields = ['name']
|
||||
|
@ -6,7 +6,8 @@ from .views import (
|
||||
place_list_view,
|
||||
SignUpView,
|
||||
PlaceCreateView,
|
||||
PlaceUpdateView
|
||||
PlaceUpdateView,
|
||||
PlaceDeleteView
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
@ -16,5 +17,6 @@ urlpatterns = [
|
||||
path('place/<int:pk>/', place_detail_view, name='place_detail'),
|
||||
path('place/create/', PlaceCreateView.as_view(), name='place_create'),
|
||||
path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'),
|
||||
path('place/delete/<int:pk>/', PlaceDeleteView.as_view(), name='place_delete'),
|
||||
path('place/', place_list_view, name='place_list')
|
||||
]
|
||||
|
@ -9,7 +9,12 @@ from django.views import View
|
||||
from django.http import Http404
|
||||
from django.views.generic.edit import UpdateView
|
||||
|
||||
from .forms import ExplorerCreationForm, PlaceForm, PlaceImageCreateForm
|
||||
from .forms import (
|
||||
ExplorerCreationForm,
|
||||
PlaceForm,
|
||||
PlaceImageCreateForm,
|
||||
PlaceDeleteForm
|
||||
)
|
||||
from .models import Place, PlaceImage, Voucher
|
||||
|
||||
# Create your views here.
|
||||
@ -90,3 +95,14 @@ class PlaceCreateView(View):
|
||||
submitted_by=submitter
|
||||
)
|
||||
place_image.save()
|
||||
|
||||
class PlaceDeleteView(View):
|
||||
template_name = 'delete_place.html'
|
||||
model = Place
|
||||
form_class = PlaceDeleteForm
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
place_delete_form = PlaceDeleteForm()
|
||||
|
||||
context = {'place_form': place_delete_form}
|
||||
return render(request, 'create_place.html', context)
|
||||
|
Loading…
Reference in New Issue
Block a user