From 1a8da002cf4ba19b8b225d045ef4f9688edfa87d Mon Sep 17 00:00:00 2001 From: reverend Date: Sun, 13 Sep 2020 20:39:32 +0200 Subject: [PATCH] Formatting --- .../lostplaces_app/views/place_views.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lostplaces/lostplaces_app/views/place_views.py b/lostplaces/lostplaces_app/views/place_views.py index ba48a40..a4124e6 100644 --- a/lostplaces/lostplaces_app/views/place_views.py +++ b/lostplaces/lostplaces_app/views/place_views.py @@ -90,23 +90,19 @@ class PlaceCreateView(IsAuthenticatedMixin, View): submitter=submitter ) - kwargs_to_pass = { - 'pk': place.pk - } - messages.success( - self.request, 'Successfully created place.') - return redirect(reverse_lazy('place_detail', kwargs=kwargs_to_pass)) + self.request, + 'Successfully created place.' + ) + return redirect(reverse_lazy('place_detail', kwargs={'pk': place.pk})) 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) + self.request, + 'Please fill in all required fields.' + ) + return render(request, 'place/place_create.html', context={'form': form_place}) def _apply_multipart_image_upload(self, files, place, submitter): for image in files: