cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
news.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_clm.news
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.news import NewsForm
31 from wi.utils.decorators import user_permission, admin_clm_permission
32 from wi.utils.views import form_generic, simple_generic_id
33 
34 
35 news_patterns = patterns('wi.views.admin_clm.news',
36  url(r'^ajax/add_news/$', admin_clm_permission(form_generic),
37  {'template_name': 'generic/form.html',
38  'success_msg': (lambda desc, data: _('News entry added.') % {'desc': desc}),
39  'confirmation': _('Create'),
40  'request_url_post': 'admin_clm/news/add/',
41  'form_class': NewsForm},
42  name='mai_ajax_add_news'),
43  url(r'^ajax/delete_news/(?P<id1>\d+)/$', user_permission(simple_generic_id),
44  {'template_name': 'generic/simple.html',
45  'success_msg': (lambda desc: _('You have successfully removed news entry <b>%(desc)s</b>.') % {'desc': desc}),
46  'ask_msg': (lambda desc: _('Do you want to delete news entry <b>%(desc)s</b>?') % {'desc': desc}),
47  'request_url': 'admin_clm/news/delete/',
48  'id_key': 'news_id'},
49  name='mai_ajax_delete_news'),
50  url(r'^ajax/edit_news/(?P<id1>\d+)/$', 'mai_ajax_edit_news', name='mai_ajax_edit_news'),
51 )
52 
53 urlpatterns = patterns('',
54  url(r'^news/', include(news_patterns)),
55 )
56