Renamed PlaceImageCreateForm to PlaceImageForm.
This commit is contained in:
parent
2a3ee3de8d
commit
eb7fe88d59
@ -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']
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user