Renamed PlaceImageCreateForm to PlaceImageForm.

This commit is contained in:
Marcus Scholz 2020-09-18 23:50:25 +02:00
parent 2a3ee3de8d
commit eb7fe88d59
3 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ class PlaceForm(forms.ModelForm):
fields = '__all__' fields = '__all__'
exclude = ['submitted_by'] exclude = ['submitted_by']
class PlaceImageCreateForm(forms.ModelForm): class PlaceImageForm(forms.ModelForm):
class Meta: class Meta:
model = PlaceImage model = PlaceImage
fields = ['filename'] fields = ['filename']

View File

@ -12,7 +12,7 @@ from lostplaces.views import (
PlaceListView, PlaceListView,
PlaceDetailView PlaceDetailView
) )
from lostplaces.forms import PlaceImageCreateForm, PlaceForm from lostplaces.forms import PlaceImageForm, PlaceForm
from lostplaces.tests.views import ( from lostplaces.tests.views import (
ViewTestCase, ViewTestCase,
TaggableViewTestCaseMixin, TaggableViewTestCaseMixin,
@ -49,7 +49,7 @@ class TestPlaceCreateView(ViewTestCase):
self.client.login(username='testpeter', password='Develop123') self.client.login(username='testpeter', password='Develop123')
response = self.client.get(reverse('place_create')) response = self.client.get(reverse('place_create'))
self.assertHasForm(response, 'place_image_form', PlaceImageCreateForm) self.assertHasForm(response, 'place_image_form', PlaceImageForm)
self.assertHasForm(response, 'place_form', PlaceForm) self.assertHasForm(response, 'place_form', PlaceForm)

View File

@ -11,7 +11,7 @@ from django.urls import reverse_lazy
from lostplaces.models import Place, PlaceImage from lostplaces.models import Place, PlaceImage
from lostplaces.views import IsAuthenticatedMixin, IsPlaceSubmitterMixin from lostplaces.views import IsAuthenticatedMixin, IsPlaceSubmitterMixin
from lostplaces.forms import PlaceForm, PlaceImageCreateForm, TagSubmitForm from lostplaces.forms import PlaceForm, PlaceImageForm, TagSubmitForm
from taggit.models import Tag from taggit.models import Tag
@ -64,7 +64,7 @@ class PlaceUpdateView(IsAuthenticatedMixin, IsPlaceSubmitterMixin, SuccessMessag
class PlaceCreateView(IsAuthenticatedMixin, View): class PlaceCreateView(IsAuthenticatedMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
place_image_form = PlaceImageCreateForm() place_image_form = PlaceImageForm()
place_form = PlaceForm() place_form = PlaceForm()
context = { context = {
@ -102,7 +102,7 @@ class PlaceCreateView(IsAuthenticatedMixin, View):
self.request, self.request,
'Please fill in all required fields.' 'Please fill in all required fields.'
) )
return render(request, 'place/place_create.html', context={'form': form_place}) return render(request, 'place/place_create.html', context={'form': place_form})
def _apply_multipart_image_upload(self, files, place, submitter): def _apply_multipart_image_upload(self, files, place, submitter):
for image in files: for image in files: