Skip to content

Commit

Permalink
minor changes to HTML5ModelConverter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
peskk3am committed Apr 19, 2014
1 parent 8cfdfd7 commit 271619b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions simplestore/lib/simplestore_model/HTML5ModelConverter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
## This file is part of SimpleStore.
## Copyright (C) 2013 EPCC, The University of Edinburgh.
##
Expand Down Expand Up @@ -27,7 +28,6 @@
from wtforms.compat import text_type
from flask import current_app


class SwitchInput(Input):
input_type = "checkbox"

Expand Down Expand Up @@ -202,15 +202,16 @@ class SelectFieldWithInput(SelectField):
filtering = ""
other = ""

def __init__(self, other="", filtering="", cardinality="1",
def __init__(self, other="", filtering="", cardinality=1,
data_provide="", data_source="", **field_args):
# make list of tuples for SelectField (only once)
self.cardinality = cardinality
self.other = other
self.filtering = filtering
# make list of tuples for SelectField (only once)
if isinstance(data_source[0], basestring):
field_args['choices'] = [(x,x) for x in data_source]
field_args['choices'].append(('other', other))
if other:
field_args['choices'].append(('other', other))
super(SelectFieldWithInput, self).__init__(**field_args)


Expand Down

0 comments on commit 271619b

Please sign in to comment.