Skip to content
Snippets Groups Projects
Verified Commit 08e7a9ae authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Remove coords from form; instead add a checkbox to enable/disable

parent 035b4097
No related branches found
No related tags found
1 merge request!30Resolve "Checkpoint system"
......@@ -508,8 +508,7 @@ class EventCheckpointForm(forms.Form):
js = ("https://unpkg.com/html5-qrcode", "js/paweljong/checkpoint.js")
layout = Layout(
"username", "comment",
Row("lat", "lon"),
"comment", "use_latlon",
)
comment = forms.CharField(
......@@ -523,6 +522,13 @@ class EventCheckpointForm(forms.Form):
label=_("Person"),
widget=forms.TextInput(attrs={"autofocus": "", "autocomplete": "off"}),
help_text=_("Please enter a username."),
widget=forms.HiddenInput(),
)
use_latlon = forms.BooleanField(
required=False,
label=_("Submit geolocation"),
default=True,
)
lat = forms.DecimalField(
......@@ -531,7 +537,7 @@ class EventCheckpointForm(forms.Form):
max_value=90.0,
max_digits=10,
decimal_places=8,
# widget=forms.HiddenInput()
widget=forms.HiddenInput(),
)
lon = forms.DecimalField(
required=False,
......@@ -539,5 +545,5 @@ class EventCheckpointForm(forms.Form):
max_value=180.0,
max_digits=11,
decimal_places=8,
# widget=forms.HiddenInput()
widget=forms.HiddenInput(),
)
......@@ -992,7 +992,7 @@ class EventCheckpointView(PermissionRequiredMixin, FormView):
checkpoint.comment = form.cleaned_data["comment"]
checkpoint.timestamp = timezone.now()
if "lat" in form.cleaned_data and "lon" in form.cleaned_data:
if form.cleaned_data["use_latlon"]:
checkpoint.lat = form.cleaned_data["lat"]
checkpoint.lon = form.cleaned_data["lon"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment