Small refactoring
This commit is contained in:
parent
fc4167ffc2
commit
2fa4874c08
@ -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)
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user