#43 Lat/Long Check when place is submitted

This commit is contained in:
reverend 2020-12-24 19:47:17 +01:00
parent b845cc054a
commit dc79b9d05c
2 changed files with 17 additions and 2 deletions

View File

@ -44,7 +44,15 @@ class PlaceForm(forms.ModelForm):
class Meta: class Meta:
model = Place model = Place
fields = '__all__' 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 PlaceImageForm(forms.ModelForm):
class Meta: class Meta:

View File

@ -104,7 +104,14 @@ class PlaceCreateView(MultiplePlaceImageUploadMixin, 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': 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): class PlaceDeleteView(IsAuthenticatedMixin, IsPlaceSubmitterMixin, DeleteView):
template_name = 'place/place_delete.html' template_name = 'place/place_delete.html'