Félix Baylac-Jacqué 6 years ago
parent
commit
3f58db4c23
3 changed files with 17 additions and 19 deletions
  1. 1 1
      ffdnispdb/constants.py
  2. 14 16
      ffdnispdb/forms.py
  3. 2 2
      ffdnispdb/templates/project_form_generic.html

+ 1 - 1
ffdnispdb/constants.py

@@ -32,4 +32,4 @@ IPV6_SUPPORT = {
     2: _('partial'),
     3: _('quite good'),
     4: _('full')
-} 
+}

+ 14 - 16
ffdnispdb/forms.py

@@ -131,8 +131,9 @@ class OtherWebsites(InsecureForm):
                     validators=[Optional(), URL(require_tld=True)])
 
 
-STEP_CHOICES = [(k, LazyProxy(lambda k, s: u'%u - %s' % (k, s), k, STEPS[k], enable_cache=False)) for k in STEPS]
-
+def generate_choices(choices):
+    return [(k, LazyProxy(lambda k, s: u'%u - %s' % (k, s), k, choices[k], enable_cache=False))
+            for k in choices]
 
 class ProjectForm(Form):
     name = TextField(_(u'full name'),
@@ -186,16 +187,12 @@ class ProjectForm(Form):
         validators=[Optional(), NumberRange(min=-180, max=180)])
 
     step = SelectField(_(u'progress step'),
-        choices=STEP_CHOICES, coerce=int)
+        choices=generate_choices(STEPS), coerce=int)
 
     member_count = IntegerField(_(u'members'),
         validators=[Optional(), NumberRange(min=0)],
         description=[None, _(u'Number of members')])
 
-    subscriber_count = IntegerField(_(u'subscribers'),
-        validators=[Optional(), NumberRange(min=0)],
-        description=[None, _(u'Number of subscribers to an internet access')])
-
     tech_email = TextField(_('Email'),
         validators=[Email(), DataRequired()], description=[None,
         _('Technical contact, in case of problems with your submission')])
@@ -207,8 +204,9 @@ class ProjectForm(Form):
         description=[None, _('Autonomous System (AS) number.')])
 
     arcep_code = TextField(_(u'arcep code'),
-        validators=[Optional()],
-        description=[None, _(u'The identifier assigned by the ARCEP')])
+        validators=[Optional()], description=[None,
+            _(u'<a href="https://en.wikipedia.org/wiki/Autorit%%C3%%A9_de_R%%C3%%A9gulation_des_Communications_%%C3%%89lectroniques_et_des_Postes">Arcep</a> identifier')])
+        #description=[None, _(u'The identifier assigned by the ARCEP')])
 
     xdsl = IntegerField(_(u'xdsl subscribers'),
         validators=[Optional(), NumberRange(min=0)],
@@ -226,13 +224,13 @@ class ProjectForm(Form):
         validators=[Optional(), NumberRange(min=0)],
         description=[None, _(u'Number of fiber subscribers')])
 
-    statutes = TextField(_(u'statutes',
+    statutes = TextField(_(u'statutes url',
         validators=[Optional(), URL(require_tld=True)],
-        description=[None, _(u'URL pointing to the organisation statutes.')]))
+        description=[None, _(u'URL pointing to the organisation statutes')]))
 
-    internal_rules = TextField(_(u'internal rules',
+    internal_rules = TextField(_(u'internal rules url',
         validators=[Optional(), URL(require_tld=True)],
-        description=[None, _(u'URL pointing to the organisation internal rules.')]))
+        description=[_(u'URL pointing to the organisation internal rules'), _(u'URL pointing to the organisation internal rules')]))
 
     internet_cube = BooleanField(_(u'internet cube'),
         validators=[Optional()],
@@ -243,13 +241,13 @@ class ProjectForm(Form):
         description=[None, _(u'Participating to the NL-NOG RING? See <code>https://ring.nlnog.net/</code>')])
 
     ipv6_servers = SelectField(_(u'ipv6 servers'),
-        choices=IPV6_SUPPORT,
+        choices=generate_choices(IPV6_SUPPORT),
         coerce=int,
         validators=[Optional()],
         description=[None, _(u'Servers can be reached in IPV6?')])
 
     ipv6_subscribers = SelectField(_(u'ipv6 subscribers'),
-        choices=IPV6_SUPPORT, validators=[Optional()],
+        choices=generate_choices(IPV6_SUPPORT), validators=[Optional()],
         coerce=int,
         description=[None, _(u'Subscribers are provided with IPV6 connectivity?')])
 
@@ -317,7 +315,7 @@ class ProjectForm(Form):
         optstr('asn', self.asn.data)
         optstr('arcepCode', self.arcep_code.data)
         optstr('internetcube', self.internet_cube.data)
-        optstr('nlnogParticipant', self.nlnog_participant)
+        optstr('nlnogParticipant', self.nlnog_participant.data)
         optobj('publicDocuments', {
             'statutes': self.statutes.data,
             'internalRules': self.internal_rules.data})

+ 2 - 2
ffdnispdb/templates/project_form_generic.html

@@ -46,12 +46,12 @@
         {{ fm.render_field(form.internet_cube) }}
 
         {{ fm.render_field(form.member_count, class_="input-small") }}
-        {{ fm.render_field(form.subscriber_count, class_="input-small") }}
         {{ fm.render_field(form.xdsl, class_="input-small") }}
         {{ fm.render_field(form.vpn, class_="input-small") }}
         {{ fm.render_field(form.wifi, class_="input-small") }}
         {{ fm.render_field(form.fiber, class_="input-small") }}
-        {{ fm.render_field(form.nlnog_participant) }}
+        {{ fm.render_field(form.ipv6_servers) }}
+        {{ fm.render_field(form.ipv6_subscribers) }}
         <div class="control-group required{% if form.covered_areas.errors %} error{% endif %}">
           <label class="control-label" for="coordinates">{{ form.covered_areas.label.text }}</label>
           <div class="controls">