119 |
119 |
120 self._rights = dicts.merge(rights, new_rights) |
120 self._rights = dicts.merge(rights, new_rights) |
121 self._params = dicts.merge(params, new_params) |
121 self._params = dicts.merge(params, new_params) |
122 |
122 |
123 def public(self, request, page_name=None, params=None, **kwargs): |
123 def public(self, request, page_name=None, params=None, **kwargs): |
124 """Displays the public page for the entity specified by **kwargs |
124 """Displays the public page for the entity specified by **kwargs. |
125 |
125 |
126 Args: |
126 Args: |
127 request: the standard Django HTTP request object |
127 request: the standard Django HTTP request object |
128 page: a soc.logic.site.page.Page object which is abstraction |
128 page: a soc.logic.site.page.Page object which is abstraction |
129 that combines a Django view with sidebar menu info |
129 that combines a Django view with sidebar menu info |
162 template = params['public_template'] |
162 template = params['public_template'] |
163 |
163 |
164 return helper.responses.respond(request, template, context) |
164 return helper.responses.respond(request, template, context) |
165 |
165 |
166 def create(self, request, page_name=None, params=None, **kwargs): |
166 def create(self, request, page_name=None, params=None, **kwargs): |
167 """Displays the create page for this entity type |
167 """Displays the create page for this entity type. |
168 |
168 |
169 Args: |
169 Args: |
170 request: the standard Django HTTP request object |
170 request: the standard Django HTTP request object |
171 page: a soc.logic.site.page.Page object which is abstraction |
171 page: a soc.logic.site.page.Page object which is abstraction |
172 that combines a Django view with sidebar menu info |
172 that combines a Django view with sidebar menu info |
191 return self.edit(request, page_name=page_name, params=params, **empty_kwargs) |
191 return self.edit(request, page_name=page_name, params=params, **empty_kwargs) |
192 else: |
192 else: |
193 return self.edit(request, page_name=page_name, params=params, seed=kwargs, **empty_kwargs) |
193 return self.edit(request, page_name=page_name, params=params, seed=kwargs, **empty_kwargs) |
194 |
194 |
195 def edit(self, request, page_name=None, params=None, seed=None, **kwargs): |
195 def edit(self, request, page_name=None, params=None, seed=None, **kwargs): |
196 """Displays the edit page for the entity specified by **kwargs |
196 """Displays the edit page for the entity specified by **kwargs. |
197 |
197 |
198 Args: |
198 Args: |
199 request: the standard Django HTTP request object |
199 request: the standard Django HTTP request object |
200 page: a soc.logic.site.page.Page object which is abstraction |
200 page: a soc.logic.site.page.Page object which is abstraction |
201 that combines a Django view with sidebar menu info |
201 that combines a Django view with sidebar menu info |
232 return self.editPost(request, entity, context, params) |
232 return self.editPost(request, entity, context, params) |
233 else: |
233 else: |
234 return self.editGet(request, entity, context, seed, params) |
234 return self.editGet(request, entity, context, seed, params) |
235 |
235 |
236 def editPost(self, request, entity, context, params): |
236 def editPost(self, request, entity, context, params): |
237 """Same as edit, but on POST |
237 """Same as edit, but on POST. |
238 """ |
238 """ |
239 |
239 |
240 params = dicts.merge(params, self._params) |
240 params = dicts.merge(params, self._params) |
241 |
241 |
242 if entity: |
242 if entity: |
271 return helper.responses.redirectToChangedSuffix( |
271 return helper.responses.redirectToChangedSuffix( |
272 request, old_suffix, suffix, |
272 request, old_suffix, suffix, |
273 params=page_params) |
273 params=page_params) |
274 |
274 |
275 def editGet(self, request, entity, context, seed, params): |
275 def editGet(self, request, entity, context, seed, params): |
276 """Same as edit, but on GET |
276 """Same as edit, but on GET. |
277 """ |
277 """ |
278 |
278 |
279 params = dicts.merge(params, self._params) |
279 params = dicts.merge(params, self._params) |
280 suffix = self._logic.getKeySuffix(entity) |
280 suffix = self._logic.getKeySuffix(entity) |
281 |
281 |
305 form = params['create_form']() |
305 form = params['create_form']() |
306 |
306 |
307 return self._constructResponse(request, entity, context, form, params) |
307 return self._constructResponse(request, entity, context, form, params) |
308 |
308 |
309 def list(self, request, page_name=None, params=None): |
309 def list(self, request, page_name=None, params=None): |
310 """Displays the list page for the entity type |
310 """Displays the list page for the entity type. |
311 |
311 |
312 Args: |
312 Args: |
313 request: the standard Django HTTP request object |
313 request: the standard Django HTTP request object |
314 page: a soc.logic.site.page.Page object which is abstraction |
314 page: a soc.logic.site.page.Page object which is abstraction |
315 that combines a Django view with sidebar menu info |
315 that combines a Django view with sidebar menu info |
346 template = params['list_template'] |
346 template = params['list_template'] |
347 |
347 |
348 return helper.responses.respond(request, template, context) |
348 return helper.responses.respond(request, template, context) |
349 |
349 |
350 def delete(self, request, page_name=None, params=None, **kwargs): |
350 def delete(self, request, page_name=None, params=None, **kwargs): |
351 """Shows the delete page for the entity specified by kwargs |
351 """Shows the delete page for the entity specified by **kwargs. |
352 |
352 |
353 Args: |
353 Args: |
354 request: the standard Django HTTP request object |
354 request: the standard Django HTTP request object |
355 page: a soc.logic.site.page.Page object which is abstraction |
355 page: a soc.logic.site.page.Page object which is abstraction |
356 that combines a Django view with sidebar menu info |
356 that combines a Django view with sidebar menu info |
395 redirect = params['delete_redirect'] |
395 redirect = params['delete_redirect'] |
396 |
396 |
397 return http.HttpResponseRedirect(redirect) |
397 return http.HttpResponseRedirect(redirect) |
398 |
398 |
399 def _editPost(self, request, entity, fields): |
399 def _editPost(self, request, entity, fields): |
400 """Performs any required processing on the entity to post its edit page |
400 """Performs any required processing on the entity to post its edit page. |
401 |
401 |
402 Args: |
402 Args: |
403 request: the django request object |
403 request: the django request object |
404 entity: the entity to create or update from POST contents |
404 entity: the entity to create or update from POST contents |
405 fields: the new field values |
405 fields: the new field values |
406 """ |
406 """ |
407 |
407 |
408 pass |
408 pass |
409 |
409 |
410 def _public(self, request, entity, context): |
410 def _public(self, request, entity, context): |
411 """Performs any required processing to get an entities public page |
411 """Performs any required processing to get an entities public page. |
412 |
412 |
413 Args: |
413 Args: |
414 request: the django request object |
414 request: the django request object |
415 entity: the entity to make public |
415 entity: the entity to make public |
416 context: the context object |
416 context: the context object |
417 """ |
417 """ |
418 |
418 |
419 pass |
419 pass |
420 |
420 |
421 def _editGet(self, request, entity, form): |
421 def _editGet(self, request, entity, form): |
422 """Performs any required processing on the form to get its edit page |
422 """Performs any required processing on the form to get its edit page. |
423 |
423 |
424 Args: |
424 Args: |
425 request: the django request object |
425 request: the django request object |
426 entity: the entity to get |
426 entity: the entity to get |
427 form: the django form that will be used for the page |
427 form: the django form that will be used for the page |
428 """ |
428 """ |
429 |
429 |
430 pass |
430 pass |
431 |
431 |
432 def _editSeed(self, request, seed): |
432 def _editSeed(self, request, seed): |
433 """Performs any required processing on the form to get its edit page |
433 """Performs any required processing on the form to get its edit page. |
434 |
434 |
435 Args: |
435 Args: |
436 request: the django request object |
436 request: the django request object |
437 seed: the fields to seed the create page with |
437 seed: the fields to seed the create page with |
438 """ |
438 """ |
439 |
439 |
440 pass |
440 pass |
441 |
441 |
442 def checkUnspecified(self, access_type, request): |
442 def checkUnspecified(self, access_type, request): |
443 """Checks whether an unspecified access_type should be allowed |
443 """Checks whether an unspecified access_type should be allowed. |
444 |
444 |
445 Args: |
445 Args: |
446 access_type: the access type (such as 'list' or 'edit') that was |
446 access_type: the access type (such as 'list' or 'edit') that was |
447 not present in the _rights dictionary when checking. |
447 not present in the _rights dictionary when checking. |
448 """ |
448 """ |
449 |
449 |
450 pass |
450 pass |
451 |
451 |
452 def _constructResponse(self, request, entity, context, form, params): |
452 def _constructResponse(self, request, entity, context, form, params): |
453 """Updates the context and returns a response for the specified arguments |
453 """Updates the context and returns a response for the specified arguments. |
454 |
454 |
455 Args: |
455 Args: |
456 request: the django request object |
456 request: the django request object |
457 entity: the entity that is used |
457 entity: the entity that is used |
458 context: the context to be used |
458 context: the context to be used |