From 2fa4874c08b423d2baf88d0f33c3d9110f04f95b Mon Sep 17 00:00:00 2001 From: reverend Date: Thu, 30 Jul 2020 22:33:41 +0200 Subject: [PATCH] Small refactoring --- lostplaces/lostplaces_app/forms.py | 4 ++-- lostplaces/lostplaces_app/views.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lostplaces/lostplaces_app/forms.py b/lostplaces/lostplaces_app/forms.py index 38120ed..e3d61f6 100644 --- a/lostplaces/lostplaces_app/forms.py +++ b/lostplaces/lostplaces_app/forms.py @@ -25,8 +25,8 @@ class PlaceImageCreateForm(forms.ModelForm): fields = '__all__' exclude = ['submitted_by', 'place', 'description'] widgets = { - 'filename': forms.ClearableFileInput(attrs={'multiple': True}), - }, + 'filename': forms.ClearableFileInput(attrs={'multiple': True}) + } def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/lostplaces/lostplaces_app/views.py b/lostplaces/lostplaces_app/views.py index b2c8c63..2bb5685 100644 --- a/lostplaces/lostplaces_app/views.py +++ b/lostplaces/lostplaces_app/views.py @@ -51,9 +51,9 @@ class PlaceEditView(View): if request.FILES: self._apply_multipart_image_upload( - request.FILES.getlist('filename'), - place, - submitter + files=request.FILES.getlist('filename'), + place=place, + submitter=submitter ) kwargs_to_pass = { @@ -67,6 +67,7 @@ class PlaceEditView(View): return render(request, 'create_place.html', context) def _apply_multipart_image_upload(self, files, place, submitter): + print(files) for image in files: place_image = PlaceImage.objects.create( filename=image,