cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
farm.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.wi.urls.admin_cm.farm
22 #
23 # @author Krzysztof Danielowski, Piotr Wojcik
24 # @date 17.03.2011
25 #
26 
27 from django.conf.urls import url, patterns, include
28 from django.utils.translation import ungettext, ugettext_lazy as _
29 
30 from wi.forms.vm import EditVMForm
31 from wi.utils.decorators import admin_cm_permission
32 from wi.utils.views import generic_multiple_id, form_generic_id
33 
34 
35 farm_patterns = patterns('wi.views.admin_cm.farm',
36  url(r'^farms/$', 'cma_farms', name='cma_farms'),
37  url(r'^ajax/cm/farms_get_table/(?P<user_id>\d+)/$', 'cma_farms_ajax_get_table', name='cma_farms_ajax_get_table'),
38  url(r'^ajax/cm/farm_details/(?P<id1>\d+)/$', 'cma_farms_ajax_details', name='cma_farms_ajax_details'),
39  url(r'^ajax/cm/farm_destroy/$', admin_cm_permission(generic_multiple_id),
40  {'template_name': 'generic/simple.html',
41  'success_msg': (lambda desc, count: ungettext('You have successfully destroyed farm <b>%(desc)s</b>.', 'You have successfully destroyed %(count)d farms (<b>%(desc)s</b>).', count) % {'desc': desc, 'count': count}),
42  'ask_msg': (lambda desc, count: ungettext('Do you want to destroy farm <b>%(desc)s</b>?', 'Do you want to destroy %(count)d farms <b>%(desc)s</b>?', count) % {'desc': desc, 'count': count}),
43  'request_url': 'admin_cm/farm/destroy/',
44  'id_key': 'farm_ids', },
45  name='cma_farms_ajax_destroy'),
46  url(r'^ajax/cm/farm_erase/$', admin_cm_permission(generic_multiple_id),
47  {'template_name': 'generic/simple.html',
48  'success_msg': (lambda desc, count: ungettext('You have successfully erased farm <b>%(desc)s</b>.', 'You have successfully erased %(count)d farms (<b>%(desc)s</b>).', count) % {'desc': desc, 'count': count}),
49  'ask_msg': (lambda desc, count: ungettext('Do you want to erase farm <b>%(desc)s</b>?', 'Do you want to erase %(count)d farms <b>%(desc)s</b>?', count) % {'desc': desc, 'count': count}),
50  'request_url': 'admin_cm/farm/erase/',
51  'id_key': 'farm_ids', },
52  name='cma_farms_ajax_erase'),
53  url(r'^ajax/cm/save_and_shutdown_farm/(?P<id1>\d+)/$', admin_cm_permission(form_generic_id),
54  {'template_name': 'generic/form.html',
55  'success_msg': (lambda desc, data: _('Farm head will be saved.') % {'desc': desc}),
56  'ask_msg': (lambda desc: _('The farm will be closed. Enter a name to save head of this farm.') % {'desc': desc}),
57  'confirmation': _('Save and shutdown'),
58  'request_url_post': 'admin_cm/farm/save_and_shutdown/',
59  'request_url_get': 'admin_cm/farm/get_by_id/',
60  'id_key': 'farm_id',
61  'form_class': EditVMForm},
62  name='cma_farms_ajax_save_and_shutdown'),
63 )
64 
65 urlpatterns = patterns('',
66  url(r'^admin_cm/', include(farm_patterns)),
67 )
68