|
1 #!/usr/bin/python2.5 |
|
2 # |
|
3 # Copyright 2009 the Melange authors. |
|
4 # |
|
5 # Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 # you may not use this file except in compliance with the License. |
|
7 # You may obtain a copy of the License at |
|
8 # |
|
9 # http://www.apache.org/licenses/LICENSE-2.0 |
|
10 # |
|
11 # Unless required by applicable law or agreed to in writing, software |
|
12 # distributed under the License is distributed on an "AS IS" BASIS, |
|
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 # See the License for the specific language governing permissions and |
|
15 # limitations under the License. |
|
16 |
|
17 """Views for GradingSurveyGroup. |
|
18 """ |
|
19 |
|
20 __authors__ = [ |
|
21 '"Lennard de Rijk" <ljvderijk@gmail.com>', |
|
22 ] |
|
23 |
|
24 |
|
25 from soc.logic import dicts |
|
26 from soc.views.helper import access |
|
27 from soc.views.models import base |
|
28 |
|
29 import soc.logic.models.grading_survey_group |
|
30 |
|
31 |
|
32 class View(base.View): |
|
33 """View methods for the GradingSurveyGroup model. |
|
34 """ |
|
35 |
|
36 def __init__(self, params=None): |
|
37 """Defines the fields and methods required for the base View class |
|
38 to provide the user with list, public, create, edit and delete views. |
|
39 |
|
40 Params: |
|
41 params: a dict with params for this View |
|
42 """ |
|
43 |
|
44 rights = access.Checker(params) |
|
45 rights['create'] = ['checkIsDeveloper'] |
|
46 rights['edit'] = ['checkIsDeveloper'] |
|
47 rights['delete'] = ['checkIsDeveloper'] |
|
48 rights['show'] = ['checkIsDeveloper'] |
|
49 rights['list'] = ['checkIsDeveloper'] |
|
50 |
|
51 new_params = {} |
|
52 new_params['logic'] = soc.logic.models.grading_survey_group.logic |
|
53 new_params['rights'] = rights |
|
54 new_params['name'] = "Grading Survey Group" |
|
55 |
|
56 new_params['no_admin'] = True |
|
57 new_params['no_create_raw'] = True |
|
58 new_params['no_create_with_key_fields'] = True |
|
59 |
|
60 patterns = [] |
|
61 |
|
62 params = dicts.merge(params, new_params) |
|
63 |
|
64 super(View, self).__init__(params=params) |
|
65 |
|
66 |
|
67 view = View() |
|
68 |
|
69 create = decorators.view(view.create) |
|
70 delete = decorators.view(view.delete) |
|
71 edit = decorators.view(view.edit) |
|
72 list = decorators.view(view.list) |
|
73 public = decorators.view(view.public) |