##// END OF EJS Templates
Task #99: JARSConfigurationForm_Pro y JARSConfigurationForm_Raw...
Fiorella Quino -
r124:d4f85a55474e
parent child
Show More
@@ -0,0 +1,47
1 {% extends "dev_conf_edit.html" %}
2 {% load bootstrap3 %}
3 {% load static %}
4 {% load main_tags %}
5
6 {% block extra-js%}
7 <script type="text/javascript">
8 $("#id_exp_type").on('change', function() {
9 });
10
11 $("#id_channels_number").on('change', function() {
12 updateChannelsNumber();
13 });
14
15 function updateChannelsNumber() {
16
17 var channels_number = $("#id_channels_number").val();
18 channels = $("#id_channels")
19
20 if (channels_number == 1) {
21 $(channels).val('1')
22 }
23 else if (channels_number == 2){
24 $(channels).val('1,2')
25 }
26 else if (channels_number == 3){
27 $(channels).val('1,2,3')
28 }
29 else if (channels_number == 4){
30 $(channels).val('1,2,3,4')
31 }
32 else if (channels_number == 5){
33 $(channels).val('1,2,3,4,5')
34 }
35 else if (channels_number == 6){
36 $(channels).val('1,2,3,4,5,6')
37 }
38 else if (channels_number == 7){
39 $(channels).val('1,2,3,5,6,7')
40 }
41 else {
42 $(channels).val('1,2,3,4,5,6,7,8')
43 }
44
45 }
46 </script>
47 {% endblock %} No newline at end of file
@@ -0,0 +1,47
1 {% extends "dev_conf_edit.html" %}
2 {% load bootstrap3 %}
3 {% load static %}
4 {% load main_tags %}
5
6 {% block extra-js%}
7 <script type="text/javascript">
8 $("#id_exp_type").on('change', function() {
9 });
10
11 $("#id_channels_number").on('change', function() {
12 updateChannelsNumber();
13 });
14
15 function updateChannelsNumber() {
16
17 var channels_number = $("#id_channels_number").val();
18 channels = $("#id_channels")
19
20 if (channels_number == 1) {
21 $(channels).val('1')
22 }
23 else if (channels_number == 2){
24 $(channels).val('1,2')
25 }
26 else if (channels_number == 3){
27 $(channels).val('1,2,3')
28 }
29 else if (channels_number == 4){
30 $(channels).val('1,2,3,4')
31 }
32 else if (channels_number == 5){
33 $(channels).val('1,2,3,4,5')
34 }
35 else if (channels_number == 6){
36 $(channels).val('1,2,3,4,5,6')
37 }
38 else if (channels_number == 7){
39 $(channels).val('1,2,3,5,6,7')
40 }
41 else {
42 $(channels).val('1,2,3,4,5,6,7,8')
43 }
44
45 }
46 </script>
47 {% endblock %} No newline at end of file
@@ -64,4 +64,40 def jars_conf_edit(request, id_conf):
64 kwargs['suptitle'] = 'Edit'
64 kwargs['suptitle'] = 'Edit'
65 kwargs['button'] = 'Save'
65 kwargs['button'] = 'Save'
66
66
67 return render(request, 'jars_conf_edit.html', kwargs) No newline at end of file
67 return render(request, 'jars_conf_edit.html', kwargs)
68
69 def jars_conf_edit_prueba(request, id_conf, type):
70
71 conf = get_object_or_404(JARSConfiguration, pk=id_conf)
72
73 if request.method=='GET':
74 if type == 'PDATA':
75 form = JARSConfigurationForm_Pro(instance=conf)
76 html = 'jars_conf_edit_pro.html'
77 else:
78 form = JarsConfigurationForm_Raw(instance=conf)
79 html = 'jars_conf_edit_raw.html'
80
81 if request.method=='POST':
82 if type == 'PDATA':
83 form = JARSConfigurationForm_Pro(instance=conf)
84 html = 'jars_conf_edit_pro.html'
85 else:
86 form = JarsConfigurationForm_Raw(instance=conf)
87 html = 'jars_conf_edit_raw.html'
88
89 if form.is_valid():
90 conf = form.save(commit=False)
91 conf.save()
92 return redirect('url_jars_conf', id_conf=conf.id)
93
94 ##ERRORS
95
96 kwargs = {}
97 kwargs['id_dev'] = conf.id
98 kwargs['form'] = form
99 kwargs['title'] = 'Device Configuration'
100 kwargs['suptitle'] = 'Edit'
101 kwargs['button'] = 'Save'
102
103 return render(request, html, kwargs) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now