Added success and error messages to CreatePlaceView.

This commit is contained in:
Marcus Scholz 2020-08-12 20:35:49 +02:00
parent 4ebc8f93f7
commit 852def01d2

View File

@ -107,11 +107,19 @@ class PlaceCreateView(IsAuthenticated, View):
kwargs_to_pass = {
'pk': place.pk
}
messages.success(
self.request, 'Successfully created place.')
return redirect(reverse_lazy('place_detail', kwargs=kwargs_to_pass))
else:
context = {
'form': form_place
}
# Usually the browser should have checked the form before sending.
messages.error(
self.request, 'Please fill in all required fields.')
return render(request, 'place/place_create.html', context)
def _apply_multipart_image_upload(self, files, place, submitter):