129 params['save_message'] = [ugettext_lazy('Request saved.')] |
129 params['save_message'] = [ugettext_lazy('Request saved.')] |
130 |
130 |
131 params = dicts.merge(original_params, params) |
131 params = dicts.merge(original_params, params) |
132 |
132 |
133 base.View.__init__(self, params=params) |
133 base.View.__init__(self, params=params) |
|
134 |
|
135 |
|
136 def listSelf(self, request, page_name=None, params=None, **kwargs): |
|
137 """Displays the unhandled requests for this user. |
|
138 |
|
139 Args: |
|
140 request: the standard Django HTTP request object |
|
141 page_name: the page name displayed in templates as page and header title |
|
142 params: a dict with params for this View |
|
143 kwargs: not used |
|
144 """ |
|
145 |
|
146 new_params = {} |
|
147 new_params['list_template'] = 'soc/models/list.html' |
|
148 # TODO(SRabbelier) Change the redirect to something more useful |
|
149 new_params['list_redirect_action'] = '/' |
|
150 new_params['list_redirect_entity'] = 'Request' |
|
151 new_params['name'] = 'Request' |
|
152 new_params['name_short'] = 'Request' |
|
153 new_params['name_plural'] = 'Request' |
|
154 new_params['instruction_text'] = "An overview of your unhandeled requests" |
|
155 |
|
156 params = dicts.merge(params, new_params) |
|
157 |
|
158 # get the current user |
|
159 properties = {'account': users.get_current_user()} |
|
160 user_entity = user_logic.logic.getForFields(properties, unique=True) |
|
161 |
|
162 # only select the requests for this user that haven't been handled yet |
|
163 filter = {'requester': user_entity, |
|
164 'accepted' : False, |
|
165 'declined' : False} |
|
166 |
|
167 |
|
168 return list(request, "Unhandled Requests", params, filter) |
134 |
169 |
135 def _editSeed(self, request, seed): |
170 def _editSeed(self, request, seed): |
136 """See base.View._editGet(). |
171 """See base.View._editGet(). |
137 """ |
172 """ |
138 |
173 |
153 """ |
188 """ |
154 |
189 |
155 # fill in the account field with the user created from email |
190 # fill in the account field with the user created from email |
156 fields['user_ln'] = fields['requester'].link_id |
191 fields['user_ln'] = fields['requester'].link_id |
157 fields['group_ln'] = fields['to'].link_id |
192 fields['group_ln'] = fields['to'].link_id |
|
193 |
|
194 # make declined explicitly false when not specified |
|
195 if 'declined' not in fields: |
|
196 fields['declined'] = False |
158 |
197 |
159 |
198 |
160 view = View() |
199 view = View() |
161 |
200 |
162 create = view.create |
201 create = view.create |
163 edit = view.edit |
202 edit = view.edit |
164 delete = view.delete |
203 delete = view.delete |
165 list = view.list |
204 list = view.list |
|
205 list_self = view.listSelf |
166 public = view.public |
206 public = view.public |