Browse Source

Add the missing "tech contact" field on the manual creation form

Gu1 11 years ago
parent
commit
f89ff08a7c
3 changed files with 8 additions and 1 deletions
  1. 5 1
      ffdnispdb/forms.py
  2. 2 0
      ffdnispdb/templates/project_form.html
  3. 1 0
      ffdnispdb/views.py

+ 5 - 1
ffdnispdb/forms.py

@@ -112,6 +112,9 @@ class ProjectForm(Form):
     subscriber_count = IntegerField(_(u'subscribers'), validators=[Optional(), NumberRange(min=0)],
                                     description=[None, _('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')])
+
     def validate(self, *args, **kwargs):
         r=super(ProjectForm, self).validate(*args, **kwargs)
         if (self.latitude.data is None) != (self.longitude.data is None):
@@ -214,7 +217,8 @@ def is_url_unique(url):
 class ProjectJSONForm(Form):
     url = URLField(_(u'base url'), description=['E.g. https://isp.com/', 'A ressource implementing our '+\
                                                 'JSON-Schema specification must exist at path /isp.json'])
-    tech_email = TextField('Email', validators=[Email()], description=[None, 'Technical contact, in case of problems'])
+    tech_email = TextField(_(u'Email'), validators=[Email()], description=[None,
+                           _(u'Technical contact, in case of problems')])
 
     def validate_url(self, field):
         if not field.data.netloc:

+ 2 - 0
ffdnispdb/templates/project_form.html

@@ -7,6 +7,8 @@
       {{ form.csrf_token }}
       <fieldset>
         <legend>{{ _("Add a new project") }}</legend>
+        {{ fm.render_field(form.tech_email) }}
+        <hr />
         {{ fm.render_field(form.name) }}
         {{ fm.render_field(form.shortname) }}
         {{ fm.render_field(form.description) }}

+ 1 - 0
ffdnispdb/views.py

@@ -95,6 +95,7 @@ def create_project_form():
         isp=ISP()
         isp.name = form.name.data
         isp.shortname = form.shortname.data or None
+        isp.tech_email = form.tech_email.data
         isp.json=form.to_json(isp.json)
 
         db.session.add(isp)