cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
iso_image.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.iso_image
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 ugettext_lazy as _
29 
30 from wi.forms.iso_image import EditISOForm
31 from wi.utils.decorators import admin_cm_permission
32 from wi.utils.views import form_generic_id, simple_generic_id, direct_to_template
33 
34 
35 iso_patterns = patterns('wi.views.admin_cm.iso_image',
36  url(r'^iso/$', admin_cm_permission(direct_to_template), {'template_name': 'admin_cm/iso.html'}, name='cma_iso'),
37  url(r'^ajax/get_table_iso/$', 'cma_ajax_get_table_iso', name='cma_ajax_get_table_iso'),
38  url(r'^ajax/edit_iso/(?P<id1>\d+)/$', admin_cm_permission(form_generic_id),
39  {'template_name': 'generic/form.html',
40  'success_msg': (lambda desc, data: _('You have successfully edited selected ISO image.') % {'desc': desc}),
41  'confirmation': _('Save'),
42  'request_url_both': {'disk_controllers': 'user/iso_image/get_disk_controllers/'},
43  'request_url_post': 'admin_cm/iso_image/edit/',
44  'request_url_get': 'admin_cm/iso_image/get_by_id/',
45  'id_key': 'iso_image_id',
46  'form_class': EditISOForm,
47  },
48  name='cma_ajax_edit_iso'),
49  url(r'^ajax/delete_iso/(?P<id1>\d+)/$', admin_cm_permission(simple_generic_id),
50  {'template_name': 'generic/simple.html',
51  'success_msg': (lambda desc: _('You have successfully deleted ISO image <b>%(desc)s</b>.') % {'desc': desc}),
52  'ask_msg': (lambda desc: _('Do you want to delete ISO image <b>%(desc)s</b>?') % {'desc': desc}),
53  'request_url': 'admin_cm/iso_image/delete/',
54  'id_key': 'iso_image_id',
55  },
56  name='cma_ajax_delete_iso'),
57 
58  url(r'^ajax/copy_iso/(?P<id1>\d+)/$', 'cma_ajax_copy_iso', name='cma_ajax_copy_iso'),
59 )
60 
61 
62 urlpatterns = patterns('',
63  url(r'^admin_cm/', include(iso_patterns)),
64 )
65