Browse Source

Fix issue #12 : lat/lon message for required validator

Users must fill the latitude and the longitude of their place using a
map

We tell hir to do so when hir forgets it

Signed-off-by: CapsLock <faimaison@legeox.net>
CapsLock 9 years ago
parent
commit
c935814000
1 changed files with 6 additions and 0 deletions
  1. 6 0
      wifiwithme/apps/contribmap/forms.py

+ 6 - 0
wifiwithme/apps/contribmap/forms.py

@@ -62,3 +62,9 @@ class PublicContribForm(forms.ModelForm):
                                .replace('public', '')\
                                .replace('public', '')\
                                .replace('publiques', '')
                                .replace('publiques', '')
             yield field
             yield field
+
+    def __init__(self, *args, **kwargs):
+        super(PublicContribForm, self).__init__(*args, **kwargs)
+
+        for f in ['latitude', 'longitude']:
+            self.fields[f].error_messages['required'] = "Veuillez sélectionner un point sur la carte"