cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
network.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.user.network
22 # @author Piotr W√≥jcik
23 # @date 19.11.2010
24 #
25 
26 from django.conf.urls import patterns, url, include
27 from django.utils.translation import ugettext_lazy as _
28 
29 from wi.forms.network import CreateNetworkForm
30 from wi.utils.decorators import user_permission
31 from wi.utils.views import direct_to_template, get_list_generic, simple_generic_id, form_generic
32 
33 
34 resources_patterns = patterns('wi.views.user.network',
35 
36  url(r'^networks/$', user_permission(direct_to_template), {'template_name': 'resources/networks.html'}, name='res_networks'),
37  url(r'^ajax/network_table/$', user_permission(get_list_generic),
38  {'request_url': 'user/network/list_user_networks/'}, name='res_ajax_get_network_table'),
39  url(r'^ajax/add_network/$', user_permission(form_generic),
40  {'template_name': 'generic/form.html',
41  'success_msg': (lambda desc, data: _('You have successfully added a network') % {'desc': desc}),
42  'confirmation': _('Create'),
43  'form_class': CreateNetworkForm,
44  'request_url_post': 'user/network/request/', },
45  name='res_ajax_add_network'),
46  url(r'^ajax/release_network/(?P<id1>\d+)/$', user_permission(simple_generic_id),
47  {'template_name': 'generic/simple.html',
48  'success_msg': (lambda desc: _('You have successfully released network <b>%(desc)s</b>.') % {'desc': desc}),
49  'ask_msg': (lambda desc: _('Do you want to release network <b>%(desc)s</b>?') % {'desc': desc}),
50  'request_url': 'user/network/release/',
51  'id_key': 'network_id', },
52  name='res_ajax_release_network'),
53 )
54 
55 urlpatterns = patterns('',
56  url(r'^resources/', include(resources_patterns)),
57 )
58