diff --git a/django_lostplaces/lostplaces/forms.py b/django_lostplaces/lostplaces/forms.py index 7cd51e3..9cbb37f 100644 --- a/django_lostplaces/lostplaces/forms.py +++ b/django_lostplaces/lostplaces/forms.py @@ -44,7 +44,15 @@ class PlaceForm(forms.ModelForm): class Meta: model = Place fields = '__all__' - exclude = ['submitted_by'] + exclude = ['submitted_by', 'latitude', 'longitute'] + + latitude = forms.IntegerField( + widget=forms.NumberInput(attrs={'min':-90,'max': 90,'type': 'number'}) + ) + + longitude = forms.IntegerField( + widget=forms.NumberInput(attrs={'min':-180,'max': 180,'type': 'number'}) + ) class PlaceImageForm(forms.ModelForm): class Meta: diff --git a/django_lostplaces/lostplaces/views/place_views.py b/django_lostplaces/lostplaces/views/place_views.py index c96726b..0d3ecb4 100644 --- a/django_lostplaces/lostplaces/views/place_views.py +++ b/django_lostplaces/lostplaces/views/place_views.py @@ -104,7 +104,14 @@ class PlaceCreateView(MultiplePlaceImageUploadMixin, IsAuthenticatedMixin, View) self.request, _('Please fill in all required fields.') ) - return render(request, 'place/place_create.html', context={'form': place_form}) + return render( + request=request, + template_name='place/place_create.html', + context={ + 'place_form': place_form, + 'place_image_form': PlaceImageForm() + } + ) class PlaceDeleteView(IsAuthenticatedMixin, IsPlaceSubmitterMixin, DeleteView): template_name = 'place/place_delete.html'