@@ -7,7 +7,7 | |||||
7 | {% block extra-content %} |
|
7 | {% block extra-content %} | |
8 |
|
8 | |||
9 | <div class="clearfix"></div> |
|
9 | <div class="clearfix"></div> | |
10 |
<h2>JARS filter: {{resolution}} |
|
10 | <h2>JARS filter: {{resolution}}</h2> | |
11 | <hr> |
|
11 | <hr> | |
12 | <div class="panel-group" id="div_lines" role="tablist" aria-multiselectable="true"> |
|
12 | <div class="panel-group" id="div_lines" role="tablist" aria-multiselectable="true"> | |
13 | {% include "jars_filter.html" %} |
|
13 | {% include "jars_filter.html" %} |
@@ -24,9 +24,12 def jars_conf(request, id_conf): | |||||
24 | kwargs['filter'] = filter_parms |
|
24 | kwargs['filter'] = filter_parms | |
25 | kwargs['filter_keys'] = ['clock', 'mult', 'fch', 'fch_decimal', |
|
25 | kwargs['filter_keys'] = ['clock', 'mult', 'fch', 'fch_decimal', | |
26 | 'filter_fir', 'filter_2', 'filter_5'] |
|
26 | 'filter_fir', 'filter_2', 'filter_5'] | |
|
27 | ||||
27 | filter_resolution=conf.filter_resolution() |
|
28 | filter_resolution=conf.filter_resolution() | |
28 | kwargs['resolution'] = filter_resolution |
|
29 | kwargs['resolution'] = '{} (MHz)'.format(filter_resolution) | |
29 |
|
30 | if filter_resolution < 1: | ||
|
31 | kwargs['resolution'] = '{} (kHz)'.format(filter_resolution*1000) | |||
|
32 | ||||
30 | kwargs['status'] = conf.device.get_status_display() |
|
33 | kwargs['status'] = conf.device.get_status_display() | |
31 |
|
34 | |||
32 |
|
35 | |||
@@ -284,10 +287,25 def change_filter(request, conf_id, filter_id=None): | |||||
284 | else: |
|
287 | else: | |
285 | form = JARSfilterForm(initial={'jars_configuration':conf_id, 'filter_id': filter_id}) |
|
288 | form = JARSfilterForm(initial={'jars_configuration':conf_id, 'filter_id': filter_id}) | |
286 |
|
289 | |||
|
290 | if request.method=='POST': | |||
|
291 | form = JARSfilterForm(request.POST) | |||
|
292 | if form.is_valid(): | |||
|
293 | jars_filter = form.cleaned_data | |||
|
294 | try: | |||
|
295 | jars_filter.pop('name') | |||
|
296 | except: | |||
|
297 | pass | |||
|
298 | conf.filter_parms = json.dumps(jars_filter) | |||
|
299 | conf.save() | |||
|
300 | return redirect('url_edit_jars_conf', id_conf=conf.id) | |||
|
301 | ||||
|
302 | print jars_filter | |||
|
303 | ||||
287 | kwargs = {} |
|
304 | kwargs = {} | |
288 | kwargs['title'] = 'JARS Configuration' |
|
305 | kwargs['title'] = 'JARS Configuration' | |
289 | kwargs['suptitle'] = 'Change Filter' |
|
306 | kwargs['suptitle'] = 'Change Filter' | |
290 | kwargs['form'] = form |
|
307 | kwargs['form'] = form | |
|
308 | kwargs['button'] = 'Change' | |||
291 | kwargs['conf_id'] = conf.id |
|
309 | kwargs['conf_id'] = conf.id | |
292 | kwargs['filter_id'] = filter_id |
|
310 | kwargs['filter_id'] = filter_id | |
293 | return render(request, 'change_jars_filter.html', kwargs) |
|
311 | return render(request, 'change_jars_filter.html', kwargs) |
General Comments 0
You need to be logged in to leave comments.
Login now