Added success and error messages to CreatePlaceView.
This commit is contained in:
parent
4ebc8f93f7
commit
852def01d2
@ -107,11 +107,19 @@ class PlaceCreateView(IsAuthenticated, View):
|
|||||||
kwargs_to_pass = {
|
kwargs_to_pass = {
|
||||||
'pk': place.pk
|
'pk': place.pk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
messages.success(
|
||||||
|
self.request, 'Successfully created place.')
|
||||||
return redirect(reverse_lazy('place_detail', kwargs=kwargs_to_pass))
|
return redirect(reverse_lazy('place_detail', kwargs=kwargs_to_pass))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
context = {
|
context = {
|
||||||
'form': form_place
|
'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)
|
return render(request, 'place/place_create.html', context)
|
||||||
|
|
||||||
def _apply_multipart_image_upload(self, files, place, submitter):
|
def _apply_multipart_image_upload(self, files, place, submitter):
|
||||||
|
Loading…
Reference in New Issue
Block a user