Commit 81daa09c authored by Mikaël Salson's avatar Mikaël Salson
Browse files

Merge branch 'feature-sc/classification_null' into 'dev'

Feature sc/classification null

See merge request !649
parents 848ebf73 bb866ba2
Pipeline #136151 passed with stages
in 7 minutes and 20 seconds
......@@ -49,10 +49,12 @@ def add_form():
error += field+" needed, "
## test if classification id exist
classification = db(db.classification.id == request.vars["config_classification"]).select()
if len(classification) == 0:
error += "classification id don't exist, "
if request.vars["config_classification"] != "-1":
classification = db(db.classification.id == request.vars["config_classification"]).count()
if classification == 0:
error += "classification id don't exist, "
else :
request.vars["config_classification"] = None
if error=="" :
......@@ -111,9 +113,13 @@ def edit_form():
error += field+" needed, "
## test if classification id exist
classification = db(db.classification.id == request.vars["config_classification"]).select()
if len(classification) == 0:
error += "classification id don't exist, "
if request.vars["config_classification"] != "-1":
classification = db(db.classification.id == request.vars["config_classification"]).count()
if classification == 0:
error += "classification id don't exist, "
else :
request.vars["config_classification"] = None
if error=="" :
......
......@@ -11,6 +11,8 @@
<tr>
<td> <label for="config_classification" id="config_classification__label">classification: </label> </td>
<td><select id="config_classification" name="config_classification">
<option value="-1" title="No classification">---</option>
{{for class_elt in classification: }}
<option value="{{=class_elt.id}}" title="{{=class_elt.info}}">{{=class_elt.name}}</option>
{{pass}}
......
......@@ -16,6 +16,8 @@ info = db.config[request.vars["id"]]
<tr>
<td> <label for="config_classification" id="config_classification__label">classification: </label> </td>
<td><select id="config_classification" name="config_classification">
<option value="-1" {{if None == info.classification:}}selected="selected"{{pass}} title="no classification">---</option>
{{for class_elt in classification: }}
<option value="{{=class_elt.id}}" {{if class_elt.id == info.classification:}}selected="selected"{{pass}} title="{{=class_elt.info}}">{{=class_elt.name}}</option>
{{pass}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment