@@ -12,9 +12,13 class SpectralWidget(forms.widgets.TextInput): | |||||
12 |
|
12 | |||
13 | def render(self, label, value, attrs=None): |
|
13 | def render(self, label, value, attrs=None): | |
14 |
|
14 | |||
15 |
|
|
15 | readonly = 'readonly' if attrs.get('readonly', False) else '' | |
16 | name = attrs.get('name', label) |
|
16 | name = attrs.get('name', label) | |
17 |
|
|
17 | print 'ESTO!' | |
|
18 | print value | |||
|
19 | if value == None: | |||
|
20 | value = '[0, 0],' | |||
|
21 | print readonly | |||
18 | if '[' in value: |
|
22 | if '[' in value: | |
19 | if value[len(value)-1] == ",": |
|
23 | if value[len(value)-1] == ",": | |
20 | value = ast.literal_eval(value) |
|
24 | value = ast.literal_eval(value) | |
@@ -34,7 +38,7 class SpectralWidget(forms.widgets.TextInput): | |||||
34 | else: |
|
38 | else: | |
35 | codes='' |
|
39 | codes='' | |
36 |
|
40 | |||
37 |
html = '''<textarea rows="5" {0} class="form-control" id="id_{1}" name="{2}" |
|
41 | html = '''<textarea rows="5" {0} class="form-control" id="id_{1}" name="{2}" style="white-space:nowrap; overflow:scroll;">{3}</textarea> | |
38 | <input type="text" class="col-md-1 col-no-padding" id="num1" value=0> |
|
42 | <input type="text" class="col-md-1 col-no-padding" id="num1" value=0> | |
39 | <input type="text" class="col-md-1 col-no-padding" id="num2" value=0> |
|
43 | <input type="text" class="col-md-1 col-no-padding" id="num2" value=0> | |
40 | <button type="button" class="button" id="add_spectral_button"> Add </button> |
|
44 | <button type="button" class="button" id="add_spectral_button"> Add </button> | |
@@ -42,7 +46,7 class SpectralWidget(forms.widgets.TextInput): | |||||
42 | <button type="button" class="button pull-right" id="cross_spectral_button"> Cross </button> |
|
46 | <button type="button" class="button pull-right" id="cross_spectral_button"> Cross </button> | |
43 | <button type="button" class="button pull-right" id="self_spectral_button"> Self </button> |
|
47 | <button type="button" class="button pull-right" id="self_spectral_button"> Self </button> | |
44 | <button type="button" class="button pull-right" id="all_spectral_button"> All </button> |
|
48 | <button type="button" class="button pull-right" id="all_spectral_button"> All </button> | |
45 |
'''.format( |
|
49 | '''.format(readonly, label, name, codes) | |
46 |
|
50 | |||
47 | script = ''' |
|
51 | script = ''' | |
48 | <script type="text/javascript"> |
|
52 | <script type="text/javascript"> |
General Comments 0
You need to be logged in to leave comments.
Login now