author | Lennard de Rijk <ljvderijk@gmail.com> |
Fri, 30 Jan 2009 10:36:23 +0000 | |
changeset 1079 | be1aacb33b0f |
parent 934 | 9fcc08971efe |
child 1126 | 4fc86db70a76 |
permissions | -rw-r--r-- |
682 | 1 |
#!/usr/bin/python2.5 |
2 |
# |
|
3 |
# Copyright 2008 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 Organizations. |
|
18 |
""" |
|
19 |
||
20 |
__authors__ = [ |
|
21 |
'"Sverre Rabbelier" <sverre@rabbelier.nl>', |
|
22 |
] |
|
23 |
||
24 |
||
25 |
from django import forms |
|
26 |
||
690
14e9f484412c
Fix imports sorting in soc.views.models.organization.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
682
diff
changeset
|
27 |
from soc.logic import cleaning |
682 | 28 |
from soc.logic import dicts |
29 |
from soc.views.helper import redirects |
|
30 |
from soc.views.models import group |
|
31 |
from soc.views.models import program as program_view |
|
32 |
||
33 |
import soc.models.organization |
|
34 |
import soc.logic.models.organization |
|
35 |
||
36 |
||
37 |
class View(group.View): |
|
38 |
"""View methods for the Organization model. |
|
39 |
""" |
|
40 |
||
41 |
def __init__(self, params=None): |
|
42 |
"""Defines the fields and methods required for the base View class |
|
43 |
to provide the user with list, public, create, edit and delete views. |
|
44 |
||
45 |
Params: |
|
46 |
original_params: a dict with params for this View |
|
47 |
""" |
|
48 |
||
49 |
new_params = {} |
|
50 |
new_params['logic'] = soc.logic.models.organization.logic |
|
51 |
||
52 |
new_params['scope_view'] = program_view |
|
53 |
new_params['scope_redirect'] = redirects.getCreateRedirect |
|
54 |
||
55 |
new_params['name'] = "Organization" |
|
56 |
new_params['url_name'] = "org" |
|
57 |
||
58 |
new_params['create_extra_dynafields'] = { |
|
59 |
'scope_path': forms.CharField(widget=forms.HiddenInput, |
|
60 |
required=True), |
|
1079
be1aacb33b0f
Changed clean_link_id to be in a wrapper form as well.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
934
diff
changeset
|
61 |
'clean_link_id': cleaning.clean_link_id('link_id'), |
682 | 62 |
} |
63 |
||
64 |
params = dicts.merge(params, new_params) |
|
65 |
||
66 |
super(View, self).__init__(params=params) |
|
67 |
||
68 |
||
69 |
view = View() |
|
70 |
||
71 |
create = view.create |
|
72 |
delete = view.delete |
|
73 |
edit = view.edit |
|
74 |
list = view.list |
|
75 |
public = view.public |
|
858
e79e7a22326f
Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents:
799
diff
changeset
|
76 |
export = view.export |
934
9fcc08971efe
Add a 'pick' view to the appropriate views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
858
diff
changeset
|
77 |
pick = view.pick |