@@ -0,0 +1,35 | |||||
|
1 | {% extends "base.html" %} | |||
|
2 | {% load bootstrap3 %} | |||
|
3 | {% load static %} | |||
|
4 | {% load main_tags %} | |||
|
5 | ||||
|
6 | {% block content-title %}{{title}}{% endblock %} | |||
|
7 | {% block content-suptitle %}{{suptitle}}{% endblock %} | |||
|
8 | ||||
|
9 | {% block content %} | |||
|
10 | {% if form.is_multipart %} | |||
|
11 | <form class="form" enctype="multipart/form-data" method="post" action="{{action}}"> | |||
|
12 | {% else %} | |||
|
13 | <form class="form" method="post" action="{{action}}"> | |||
|
14 | {% endif %} | |||
|
15 | {% csrf_token %} | |||
|
16 | {% bootstrap_form form layout='horizontal' size='medium' %} | |||
|
17 | <div style="clear: both;"></div> | |||
|
18 | <br> | |||
|
19 | {% if extra_button %} | |||
|
20 | <div class="pull-left"> | |||
|
21 | <button type="button" class="btn btn-primary" id="bt_{{extra_button}}">{{extra_button}}</button> | |||
|
22 | </div> | |||
|
23 | {% endif %} | |||
|
24 | {% if button %} | |||
|
25 | <div class="pull-right"> | |||
|
26 | <button type="button" class="btn btn-primary" onclick="{% if previous %}window.location.replace('{{ previous }}');{% else %}history.go(-1);{% endif %}">Cancel</button> | |||
|
27 | <button type="submit" class="btn btn-primary">{{button}}</button> | |||
|
28 | </div> | |||
|
29 | {% endif %} | |||
|
30 | </form> | |||
|
31 | {% endblock %} | |||
|
32 | ||||
|
33 | {% block sidebar%} | |||
|
34 | {% include "sidebar_devices.html" %} | |||
|
35 | {% endblock %} |
@@ -63,7 +63,7 class ExperimentForm(forms.ModelForm): | |||||
63 |
|
63 | |||
64 | class Meta: |
|
64 | class Meta: | |
65 | model = Experiment |
|
65 | model = Experiment | |
66 | exclude = [''] |
|
66 | exclude = ['status'] | |
67 |
|
67 | |||
68 | class LocationForm(forms.ModelForm): |
|
68 | class LocationForm(forms.ModelForm): | |
69 | class Meta: |
|
69 | class Meta: |
@@ -71,6 +71,10 class Location(models.Model): | |||||
71 | def __unicode__(self): |
|
71 | def __unicode__(self): | |
72 | return u'%s' % self.name |
|
72 | return u'%s' % self.name | |
73 |
|
73 | |||
|
74 | def get_absolute_url(self): | |||
|
75 | return reverse('url_device', args=[str(self.id)]) | |||
|
76 | ||||
|
77 | ||||
74 | class DeviceType(models.Model): |
|
78 | class DeviceType(models.Model): | |
75 |
|
79 | |||
76 | name = models.CharField(max_length = 10, choices = DEV_TYPES, default = 'rc') |
|
80 | name = models.CharField(max_length = 10, choices = DEV_TYPES, default = 'rc') | |
@@ -100,9 +104,11 class Device(models.Model): | |||||
100 | return u'%s | %s' % (self.name, self.ip_address) |
|
104 | return u'%s | %s' % (self.name, self.ip_address) | |
101 |
|
105 | |||
102 | def get_status(self): |
|
106 | def get_status(self): | |
103 |
|
||||
104 | return self.status |
|
107 | return self.status | |
105 |
|
108 | |||
|
109 | def get_absolute_url(self): | |||
|
110 | return reverse('url_device', args=[str(self.id)]) | |||
|
111 | ||||
106 |
|
112 | |||
107 | class Campaign(models.Model): |
|
113 | class Campaign(models.Model): | |
108 |
|
114 | |||
@@ -121,6 +127,9 class Campaign(models.Model): | |||||
121 | def __unicode__(self): |
|
127 | def __unicode__(self): | |
122 | return u'%s' % (self.name) |
|
128 | return u'%s' % (self.name) | |
123 |
|
129 | |||
|
130 | def get_absolute_url(self): | |||
|
131 | return reverse('url_campaign', args=[str(self.id)]) | |||
|
132 | ||||
124 |
|
133 | |||
125 | class RunningExperiment(models.Model): |
|
134 | class RunningExperiment(models.Model): | |
126 | radar = models.OneToOneField('Location', on_delete=models.CASCADE) |
|
135 | radar = models.OneToOneField('Location', on_delete=models.CASCADE) | |
@@ -145,6 +154,10 class Experiment(models.Model): | |||||
145 | def __unicode__(self): |
|
154 | def __unicode__(self): | |
146 | return u'%s' % (self.name) |
|
155 | return u'%s' % (self.name) | |
147 |
|
156 | |||
|
157 | @property | |||
|
158 | def radar(self): | |||
|
159 | return self.location | |||
|
160 | ||||
148 | def clone(self, **kwargs): |
|
161 | def clone(self, **kwargs): | |
149 |
|
162 | |||
150 | confs = Configuration.objects.filter(experiment=self, type=0) |
|
163 | confs = Configuration.objects.filter(experiment=self, type=0) | |
@@ -201,6 +214,9 class Experiment(models.Model): | |||||
201 |
|
214 | |||
202 | return color |
|
215 | return color | |
203 |
|
216 | |||
|
217 | def get_absolute_url(self): | |||
|
218 | return reverse('url_experiment', args=[str(self.id)]) | |||
|
219 | ||||
204 |
|
220 | |||
205 | class Configuration(PolymorphicModel): |
|
221 | class Configuration(PolymorphicModel): | |
206 |
|
222 |
@@ -1,32 +1,12 | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "base_edit.html" %} | |
2 | {% load bootstrap3 %} |
|
2 | {% load bootstrap3 %} | |
3 | {% load static %} |
|
3 | {% load static %} | |
4 | {% load main_tags %} |
|
4 | {% load main_tags %} | |
|
5 | ||||
5 | {% block extra-head %} |
|
6 | {% block extra-head %} | |
6 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> |
|
7 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> | |
7 | {% endblock %} |
|
8 | {% endblock %} | |
8 |
|
9 | |||
9 | {% block camp-active %}active{% endblock %} |
|
|||
10 |
|
||||
11 | {% block content-title %}{{title}}{% endblock %} |
|
|||
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} |
|
|||
13 |
|
||||
14 | {% block content %} |
|
|||
15 | <form class="form" method="post" action=""> |
|
|||
16 | {% csrf_token %} |
|
|||
17 | {% bootstrap_form form layout='horizontal' size='medium' %} |
|
|||
18 | <div style="clear: both;"></div> |
|
|||
19 | {% if button %} |
|
|||
20 | <br> |
|
|||
21 | <button type="submit" class="btn btn-primary pull-right">{{button}}</button> |
|
|||
22 | {% endif %} |
|
|||
23 | </form> |
|
|||
24 | {% endblock %} |
|
|||
25 |
|
||||
26 | {% block sidebar%} |
|
|||
27 | {% include "sidebar_devices.html" %} |
|
|||
28 | {% endblock %} |
|
|||
29 |
|
||||
30 | {% block extra-js%} |
|
10 | {% block extra-js%} | |
31 | <script src="{% static 'js/moment.min.js' %}"></script> |
|
11 | <script src="{% static 'js/moment.min.js' %}"></script> | |
32 | <script src="{% static 'js/bootstrap-datetimepicker.min.js' %}"></script> |
|
12 | <script src="{% static 'js/bootstrap-datetimepicker.min.js' %}"></script> |
@@ -6,25 +6,21 | |||||
6 | {% block content %} |
|
6 | {% block content %} | |
7 |
|
7 | |||
8 | <form action="" method="post" class="form">{% csrf_token %} |
|
8 | <form action="" method="post" class="form">{% csrf_token %} | |
9 |
{% if |
|
9 | {% if delete %} | |
10 | <input name="next" type="hidden" value="{{ next }}" /> |
|
|||
11 | {% endif %} |
|
|||
12 | {% if delete_view %} |
|
|||
13 | {% if object_name %} |
|
|||
14 | <h3>Are you sure you wish to delete {{ object_name }} from {{ object }}?</h3> |
|
|||
15 | {% else %} |
|
|||
16 | <h3>Are you sure you wish to delete: {{ object }}?</h3> |
|
10 | <h3>Are you sure you wish to delete: {{ object }}?</h3> | |
17 | {% endif %} |
|
|||
18 | {% else %} |
|
11 | {% else %} | |
19 | <h4>Are you sure you wish to proceed?</h4> |
|
12 | <h4>Are you sure you wish to proceed?</h4> | |
20 | {% endif %} |
|
13 | {% endif %} | |
21 |
{% if message %}< |
|
14 | {% if message %}<p>{{ message }}</p>{% endif %} | |
22 | <br> |
|
15 | <br> | |
|
16 | <div class="pull-right"> | |||
23 | <button class="btn btn-primary" type="submit"> |
|
17 | <button class="btn btn-primary" type="submit"> | |
24 | <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Yes |
|
18 | <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Yes | |
25 | </button> |
|
19 | </button> | |
26 | <button type="button" class="btn btn-primary" onclick="{% if previous %}window.location.replace('{{ previous }}');{% else %}history.go(-1);{% endif %}"> |
|
20 | <button type="button" class="btn btn-primary" onclick="{% if previous %}window.location.replace('{{ previous }}');{% else %}history.go(-1);{% endif %}"> | |
27 | <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> No |
|
21 | <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> No | |
28 | </button> |
|
22 | </button> | |
|
23 | </div> | |||
29 | </form> |
|
24 | </form> | |
|
25 | ||||
30 | {% endblock %} |
|
26 | {% endblock %} |
@@ -1,29 +1,1 | |||||
1 | {% extends "base.html" %} |
|
1 | {% extends "base_edit.html" %} No newline at end of file | |
2 | {% load bootstrap3 %} |
|
|||
3 | {% load static %} |
|
|||
4 | {% load main_tags %} |
|
|||
5 | {% block extra-head %} |
|
|||
6 | <link href="{% static 'css/bootstrap-datetimepicker.min.css' %}" media="screen" rel="stylesheet"> |
|
|||
7 | {% endblock %} |
|
|||
8 |
|
||||
9 | {% block dev-active %}active{% endblock %} |
|
|||
10 |
|
||||
11 | {% block content-title %}{{title}}{% endblock %} |
|
|||
12 | {% block content-suptitle %}{{suptitle}}{% endblock %} |
|
|||
13 |
|
||||
14 | {% block content %} |
|
|||
15 | <form class="form" method="post" action=""> |
|
|||
16 | {% csrf_token %} |
|
|||
17 | {% bootstrap_form form layout='horizontal' size='medium' %} |
|
|||
18 | <div style="clear: both;"></div> |
|
|||
19 | <br> |
|
|||
20 | <button type="submit" class="btn btn-primary pull-right">{{button}}</button> |
|
|||
21 | </form> |
|
|||
22 | {% endblock %} |
|
|||
23 |
|
||||
24 | {% block sidebar%} |
|
|||
25 | {% include "sidebar_devices.html" %} |
|
|||
26 | {% endblock %} |
|
|||
27 |
|
||||
28 | {% block extra-js%} |
|
|||
29 | {% endblock %} No newline at end of file |
|
@@ -17,40 +17,6 | |||||
17 | {% bootstrap_form form layout='horizontal' size='medium' %} |
|
17 | {% bootstrap_form form layout='horizontal' size='medium' %} | |
18 | <div style="clear: both;"></div> |
|
18 | <div style="clear: both;"></div> | |
19 | <br> |
|
19 | <br> | |
20 | {% if configurations %} |
|
|||
21 | <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> |
|
|||
22 | <div class="panel panel-default"> |
|
|||
23 | <div class="panel-heading" role="tab" id="headingTwo"> |
|
|||
24 | <h4 class="panel-title"> |
|
|||
25 | <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseThree"> |
|
|||
26 | Device Configurations |
|
|||
27 | </a> |
|
|||
28 | </h4> |
|
|||
29 | </div> |
|
|||
30 | <div id="collapseTwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingTwo"> |
|
|||
31 | <div class="panel-body"> |
|
|||
32 | <table class="table table-hover"> |
|
|||
33 | <tr> |
|
|||
34 | <th>#</th> |
|
|||
35 | {% for key in configuration_keys %} |
|
|||
36 | <th>{{ key|title }}</th> |
|
|||
37 | {% endfor%} |
|
|||
38 | </tr> |
|
|||
39 | {% for item in configurations %} |
|
|||
40 | <tr class="clickable-row" data-href="{{item.get_absolute_url}}"> |
|
|||
41 | <td>{{ forloop.counter }}</td> |
|
|||
42 | {% for key in configuration_keys %} |
|
|||
43 | <td>{{ item|value:key }}</td> |
|
|||
44 | {% endfor %} |
|
|||
45 | </tr> |
|
|||
46 | {% endfor %} |
|
|||
47 | </table> |
|
|||
48 | </div> |
|
|||
49 | </div> |
|
|||
50 | </div> |
|
|||
51 | </div> |
|
|||
52 | {% endif %} |
|
|||
53 |
|
||||
54 | {% if button %} |
|
20 | {% if button %} | |
55 | <br> |
|
21 | <br> | |
56 | <button type="submit" class="btn btn-primary pull-right">{{button}}</button> |
|
22 | <button type="submit" class="btn btn-primary pull-right">{{button}}</button> |
@@ -41,11 +41,13 CONF_MODELS = { | |||||
41 | 'usrp': USRPConfiguration, |
|
41 | 'usrp': USRPConfiguration, | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
|
44 | ||||
44 | def index(request): |
|
45 | def index(request): | |
45 | kwargs = {} |
|
46 | kwargs = {} | |
46 |
|
47 | |||
47 | return render(request, 'index.html', kwargs) |
|
48 | return render(request, 'index.html', kwargs) | |
48 |
|
49 | |||
|
50 | ||||
49 | def locations(request): |
|
51 | def locations(request): | |
50 |
|
52 | |||
51 | locations = Location.objects.all().order_by('name') |
|
53 | locations = Location.objects.all().order_by('name') | |
@@ -61,6 +63,7 def locations(request): | |||||
61 |
|
63 | |||
62 | return render(request, 'locations.html', kwargs) |
|
64 | return render(request, 'locations.html', kwargs) | |
63 |
|
65 | |||
|
66 | ||||
64 | def location(request, id_loc): |
|
67 | def location(request, id_loc): | |
65 |
|
68 | |||
66 | location = get_object_or_404(Location, pk=id_loc) |
|
69 | location = get_object_or_404(Location, pk=id_loc) | |
@@ -95,6 +98,7 def location_new(request): | |||||
95 |
|
98 | |||
96 | return render(request, 'location_edit.html', kwargs) |
|
99 | return render(request, 'location_edit.html', kwargs) | |
97 |
|
100 | |||
|
101 | ||||
98 | def location_edit(request, id_loc): |
|
102 | def location_edit(request, id_loc): | |
99 |
|
103 | |||
100 | location = get_object_or_404(Location, pk=id_loc) |
|
104 | location = get_object_or_404(Location, pk=id_loc) | |
@@ -117,6 +121,7 def location_edit(request, id_loc): | |||||
117 |
|
121 | |||
118 | return render(request, 'location_edit.html', kwargs) |
|
122 | return render(request, 'location_edit.html', kwargs) | |
119 |
|
123 | |||
|
124 | ||||
120 | def location_delete(request, id_loc): |
|
125 | def location_delete(request, id_loc): | |
121 |
|
126 | |||
122 | location = get_object_or_404(Location, pk=id_loc) |
|
127 | location = get_object_or_404(Location, pk=id_loc) | |
@@ -127,12 +132,19 def location_delete(request, id_loc): | |||||
127 | location.delete() |
|
132 | location.delete() | |
128 | return redirect('url_locations') |
|
133 | return redirect('url_locations') | |
129 |
|
134 | |||
130 |
|
|
135 | messages.error(request, 'Not enough permission to delete this object') | |
|
136 | return redirect(location.get_absolute_url()) | |||
131 |
|
137 | |||
132 | kwargs = {'object':location, 'loc_active':'active', |
|
138 | kwargs = { | |
133 | 'url_cancel':'url_location', 'id_item':id_loc} |
|
139 | 'title': 'Delete', | |
|
140 | 'suptitle': 'Location', | |||
|
141 | 'object': location, | |||
|
142 | 'previous': location.get_absolute_url(), | |||
|
143 | 'delete': True | |||
|
144 | } | |||
|
145 | ||||
|
146 | return render(request, 'confirm.html', kwargs) | |||
134 |
|
147 | |||
135 | return render(request, 'item_delete.html', kwargs) |
|
|||
136 |
|
148 | |||
137 | def devices(request): |
|
149 | def devices(request): | |
138 |
|
150 | |||
@@ -150,6 +162,7 def devices(request): | |||||
150 |
|
162 | |||
151 | return render(request, 'devices.html', kwargs) |
|
163 | return render(request, 'devices.html', kwargs) | |
152 |
|
164 | |||
|
165 | ||||
153 | def device(request, id_dev): |
|
166 | def device(request, id_dev): | |
154 |
|
167 | |||
155 | device = get_object_or_404(Device, pk=id_dev) |
|
168 | device = get_object_or_404(Device, pk=id_dev) | |
@@ -163,6 +176,7 def device(request, id_dev): | |||||
163 |
|
176 | |||
164 | return render(request, 'device.html', kwargs) |
|
177 | return render(request, 'device.html', kwargs) | |
165 |
|
178 | |||
|
179 | ||||
166 | def device_new(request): |
|
180 | def device_new(request): | |
167 |
|
181 | |||
168 | if request.method == 'GET': |
|
182 | if request.method == 'GET': | |
@@ -183,6 +197,7 def device_new(request): | |||||
183 |
|
197 | |||
184 | return render(request, 'device_edit.html', kwargs) |
|
198 | return render(request, 'device_edit.html', kwargs) | |
185 |
|
199 | |||
|
200 | ||||
186 | def device_edit(request, id_dev): |
|
201 | def device_edit(request, id_dev): | |
187 |
|
202 | |||
188 | device = get_object_or_404(Device, pk=id_dev) |
|
203 | device = get_object_or_404(Device, pk=id_dev) | |
@@ -195,7 +210,7 def device_edit(request, id_dev): | |||||
195 |
|
210 | |||
196 | if form.is_valid(): |
|
211 | if form.is_valid(): | |
197 | form.save() |
|
212 | form.save() | |
198 |
return redirect( |
|
213 | return redirect(device.get_absolute_url()) | |
199 |
|
214 | |||
200 | kwargs = {} |
|
215 | kwargs = {} | |
201 | kwargs['form'] = form |
|
216 | kwargs['form'] = form | |
@@ -205,6 +220,7 def device_edit(request, id_dev): | |||||
205 |
|
220 | |||
206 | return render(request, 'device_edit.html', kwargs) |
|
221 | return render(request, 'device_edit.html', kwargs) | |
207 |
|
222 | |||
|
223 | ||||
208 | def device_delete(request, id_dev): |
|
224 | def device_delete(request, id_dev): | |
209 |
|
225 | |||
210 | device = get_object_or_404(Device, pk=id_dev) |
|
226 | device = get_object_or_404(Device, pk=id_dev) | |
@@ -215,12 +231,19 def device_delete(request, id_dev): | |||||
215 | device.delete() |
|
231 | device.delete() | |
216 | return redirect('url_devices') |
|
232 | return redirect('url_devices') | |
217 |
|
233 | |||
218 |
|
|
234 | messages.error(request, 'Not enough permission to delete this object') | |
|
235 | return redirect(device.get_absolute_url()) | |||
219 |
|
236 | |||
220 | kwargs = {'object':device, 'dev_active':'active', |
|
237 | kwargs = { | |
221 | 'url_cancel':'url_device', 'id_item':id_dev} |
|
238 | 'title': 'Delete', | |
|
239 | 'suptitle': 'Device', | |||
|
240 | 'object': device, | |||
|
241 | 'previous': device.get_absolute_url(), | |||
|
242 | 'delete': True | |||
|
243 | } | |||
|
244 | ||||
|
245 | return render(request, 'confirm.html', kwargs) | |||
222 |
|
246 | |||
223 | return render(request, 'item_delete.html', kwargs) |
|
|||
224 |
|
247 | |||
225 | def campaigns(request): |
|
248 | def campaigns(request): | |
226 |
|
249 | |||
@@ -237,6 +260,7 def campaigns(request): | |||||
237 |
|
260 | |||
238 | return render(request, 'campaigns.html', kwargs) |
|
261 | return render(request, 'campaigns.html', kwargs) | |
239 |
|
262 | |||
|
263 | ||||
240 | def campaign(request, id_camp): |
|
264 | def campaign(request, id_camp): | |
241 |
|
265 | |||
242 | campaign = get_object_or_404(Campaign, pk=id_camp) |
|
266 | campaign = get_object_or_404(Campaign, pk=id_camp) | |
@@ -246,12 +270,10 def campaign(request, id_camp): | |||||
246 |
|
270 | |||
247 | kwargs = {} |
|
271 | kwargs = {} | |
248 | kwargs['campaign'] = campaign |
|
272 | kwargs['campaign'] = campaign | |
249 | kwargs['campaign_keys'] = ['name', 'start_date', 'end_date', 'tags', 'description'] |
|
273 | kwargs['campaign_keys'] = ['template', 'name', 'start_date', 'end_date', 'tags', 'description'] | |
250 |
|
274 | |||
251 | keys = ['id', 'name', 'start_time', 'end_time'] |
|
275 | kwargs['experiments'] = experiments | |
252 |
|
276 | kwargs['experiment_keys'] = ['name', 'radar', 'start_time', 'end_time'] | ||
253 | kwargs['experiment_keys'] = keys[1:] |
|
|||
254 | kwargs['experiments'] = experiments.values(*keys) |
|
|||
255 |
|
277 | |||
256 | kwargs['title'] = 'Campaign' |
|
278 | kwargs['title'] = 'Campaign' | |
257 | kwargs['suptitle'] = 'Details' |
|
279 | kwargs['suptitle'] = 'Details' | |
@@ -261,6 +283,7 def campaign(request, id_camp): | |||||
261 |
|
283 | |||
262 | return render(request, 'campaign.html', kwargs) |
|
284 | return render(request, 'campaign.html', kwargs) | |
263 |
|
285 | |||
|
286 | ||||
264 | def campaign_new(request): |
|
287 | def campaign_new(request): | |
265 |
|
288 | |||
266 | kwargs = {} |
|
289 | kwargs = {} | |
@@ -310,6 +333,7 def campaign_new(request): | |||||
310 |
|
333 | |||
311 | return render(request, 'campaign_edit.html', kwargs) |
|
334 | return render(request, 'campaign_edit.html', kwargs) | |
312 |
|
335 | |||
|
336 | ||||
313 | def campaign_edit(request, id_camp): |
|
337 | def campaign_edit(request, id_camp): | |
314 |
|
338 | |||
315 | campaign = get_object_or_404(Campaign, pk=id_camp) |
|
339 | campaign = get_object_or_404(Campaign, pk=id_camp) | |
@@ -332,6 +356,7 def campaign_edit(request, id_camp): | |||||
332 |
|
356 | |||
333 | return render(request, 'campaign_edit.html', kwargs) |
|
357 | return render(request, 'campaign_edit.html', kwargs) | |
334 |
|
358 | |||
|
359 | ||||
335 | def campaign_delete(request, id_camp): |
|
360 | def campaign_delete(request, id_camp): | |
336 |
|
361 | |||
337 | campaign = get_object_or_404(Campaign, pk=id_camp) |
|
362 | campaign = get_object_or_404(Campaign, pk=id_camp) | |
@@ -347,12 +372,19 def campaign_delete(request, id_camp): | |||||
347 |
|
372 | |||
348 | return redirect('url_campaigns') |
|
373 | return redirect('url_campaigns') | |
349 |
|
374 | |||
350 |
|
|
375 | messages.error(request, 'Not enough permission to delete this object') | |
|
376 | return redirect(campaign.get_absolute_url()) | |||
351 |
|
377 | |||
352 | kwargs = {'object':campaign, 'camp_active':'active', |
|
378 | kwargs = { | |
353 | 'url_cancel':'url_campaign', 'id_item':id_camp} |
|
379 | 'title': 'Delete', | |
|
380 | 'suptitle': 'Campaign', | |||
|
381 | 'object': campaign, | |||
|
382 | 'previous': campaign.get_absolute_url(), | |||
|
383 | 'delete': True | |||
|
384 | } | |||
|
385 | ||||
|
386 | return render(request, 'confirm.html', kwargs) | |||
354 |
|
387 | |||
355 | return render(request, 'item_delete.html', kwargs) |
|
|||
356 |
|
388 | |||
357 | def experiments(request): |
|
389 | def experiments(request): | |
358 |
|
390 | |||
@@ -371,6 +403,7 def experiments(request): | |||||
371 |
|
403 | |||
372 | return render(request, 'experiments.html', kwargs) |
|
404 | return render(request, 'experiments.html', kwargs) | |
373 |
|
405 | |||
|
406 | ||||
374 | def experiment(request, id_exp): |
|
407 | def experiment(request, id_exp): | |
375 |
|
408 | |||
376 | experiment = get_object_or_404(Experiment, pk=id_exp) |
|
409 | experiment = get_object_or_404(Experiment, pk=id_exp) | |
@@ -441,6 +474,7 def experiment_new(request, id_camp=None): | |||||
441 |
|
474 | |||
442 | return render(request, 'experiment_edit.html', kwargs) |
|
475 | return render(request, 'experiment_edit.html', kwargs) | |
443 |
|
476 | |||
|
477 | ||||
444 | def experiment_edit(request, id_exp): |
|
478 | def experiment_edit(request, id_exp): | |
445 |
|
479 | |||
446 | experiment = get_object_or_404(Experiment, pk=id_exp) |
|
480 | experiment = get_object_or_404(Experiment, pk=id_exp) | |
@@ -463,6 +497,7 def experiment_edit(request, id_exp): | |||||
463 |
|
497 | |||
464 | return render(request, 'experiment_edit.html', kwargs) |
|
498 | return render(request, 'experiment_edit.html', kwargs) | |
465 |
|
499 | |||
|
500 | ||||
466 | def experiment_delete(request, id_exp): |
|
501 | def experiment_delete(request, id_exp): | |
467 |
|
502 | |||
468 | experiment = get_object_or_404(Experiment, pk=id_exp) |
|
503 | experiment = get_object_or_404(Experiment, pk=id_exp) | |
@@ -479,6 +514,7 def experiment_delete(request, id_exp): | |||||
479 |
|
514 | |||
480 | return render(request, 'item_delete.html', kwargs) |
|
515 | return render(request, 'item_delete.html', kwargs) | |
481 |
|
516 | |||
|
517 | ||||
482 | def dev_confs(request): |
|
518 | def dev_confs(request): | |
483 |
|
519 | |||
484 | configurations = Configuration.objects.all().order_by('type', 'device__device_type', 'experiment') |
|
520 | configurations = Configuration.objects.all().order_by('type', 'device__device_type', 'experiment') | |
@@ -498,6 +534,7 def dev_confs(request): | |||||
498 |
|
534 | |||
499 | return render(request, 'dev_confs.html', kwargs) |
|
535 | return render(request, 'dev_confs.html', kwargs) | |
500 |
|
536 | |||
|
537 | ||||
501 | def dev_conf(request, id_conf): |
|
538 | def dev_conf(request, id_conf): | |
502 |
|
539 | |||
503 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
540 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -545,6 +582,7 def dev_conf_new(request, id_exp=0, id_dev=0): | |||||
545 |
|
582 | |||
546 | return render(request, 'dev_conf_edit.html', kwargs) |
|
583 | return render(request, 'dev_conf_edit.html', kwargs) | |
547 |
|
584 | |||
|
585 | ||||
548 | def dev_conf_edit(request, id_conf): |
|
586 | def dev_conf_edit(request, id_conf): | |
549 |
|
587 | |||
550 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
588 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -575,6 +613,7 def dev_conf_edit(request, id_conf): | |||||
575 |
|
613 | |||
576 | return render(request, '%s_conf_edit.html' %conf.device.device_type.name, kwargs) |
|
614 | return render(request, '%s_conf_edit.html' %conf.device.device_type.name, kwargs) | |
577 |
|
615 | |||
|
616 | ||||
578 | def dev_conf_start(request, id_conf): |
|
617 | def dev_conf_start(request, id_conf): | |
579 |
|
618 | |||
580 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
619 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -592,6 +631,7 def dev_conf_start(request, id_conf): | |||||
592 |
|
631 | |||
593 | return redirect(conf.get_absolute_url()) |
|
632 | return redirect(conf.get_absolute_url()) | |
594 |
|
633 | |||
|
634 | ||||
595 | def dev_conf_stop(request, id_conf): |
|
635 | def dev_conf_stop(request, id_conf): | |
596 |
|
636 | |||
597 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
637 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -609,6 +649,7 def dev_conf_stop(request, id_conf): | |||||
609 |
|
649 | |||
610 | return redirect(conf.get_absolute_url()) |
|
650 | return redirect(conf.get_absolute_url()) | |
611 |
|
651 | |||
|
652 | ||||
612 | def dev_conf_status(request, id_conf): |
|
653 | def dev_conf_status(request, id_conf): | |
613 |
|
654 | |||
614 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
655 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -649,6 +690,7 def dev_conf_write(request, id_conf): | |||||
649 |
|
690 | |||
650 | return redirect(conf.get_absolute_url()) |
|
691 | return redirect(conf.get_absolute_url()) | |
651 |
|
692 | |||
|
693 | ||||
652 | def dev_conf_read(request, id_conf): |
|
694 | def dev_conf_read(request, id_conf): | |
653 |
|
695 | |||
654 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
696 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -690,6 +732,7 def dev_conf_read(request, id_conf): | |||||
690 |
|
732 | |||
691 | return render(request, '%s_conf_edit.html' %conf.device.device_type.name, kwargs) |
|
733 | return render(request, '%s_conf_edit.html' %conf.device.device_type.name, kwargs) | |
692 |
|
734 | |||
|
735 | ||||
693 | def dev_conf_import(request, id_conf): |
|
736 | def dev_conf_import(request, id_conf): | |
694 |
|
737 | |||
695 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
738 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -739,6 +782,7 def dev_conf_import(request, id_conf): | |||||
739 |
|
782 | |||
740 | return render(request, 'dev_conf_import.html', kwargs) |
|
783 | return render(request, 'dev_conf_import.html', kwargs) | |
741 |
|
784 | |||
|
785 | ||||
742 | def dev_conf_export(request, id_conf): |
|
786 | def dev_conf_export(request, id_conf): | |
743 |
|
787 | |||
744 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
788 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -773,6 +817,7 def dev_conf_export(request, id_conf): | |||||
773 |
|
817 | |||
774 | return render(request, 'dev_conf_export.html', kwargs) |
|
818 | return render(request, 'dev_conf_export.html', kwargs) | |
775 |
|
819 | |||
|
820 | ||||
776 | def dev_conf_delete(request, id_conf): |
|
821 | def dev_conf_delete(request, id_conf): | |
777 |
|
822 | |||
778 | conf = get_object_or_404(Configuration, pk=id_conf) |
|
823 | conf = get_object_or_404(Configuration, pk=id_conf) | |
@@ -865,6 +910,7 def operation(request, id_camp=None): | |||||
865 |
|
910 | |||
866 | return render(request, 'operation.html', kwargs) |
|
911 | return render(request, 'operation.html', kwargs) | |
867 |
|
912 | |||
|
913 | ||||
868 | def operation_search(request, id_camp=None): |
|
914 | def operation_search(request, id_camp=None): | |
869 |
|
915 | |||
870 |
|
916 |
General Comments 0
You need to be logged in to leave comments.
Login now