No override needed in notifications.py
The only downside is that the ?s=0 parameter will still be appended
but is not handled in list(). The right solution would be to update
list() so that it does say "Message Sent" or such, to give the user
an indication that their message was sent succesfully.
Patch by: Sverre Rabbelier
--- a/app/soc/views/models/notification.py Sat Dec 13 13:27:40 2008 +0000
+++ b/app/soc/views/models/notification.py Sat Dec 13 13:28:01 2008 +0000
@@ -115,34 +115,12 @@
new_params['create_form'] = CreateForm
+ new_params['edit_redirect'] = '%(url_name)s/list'
+
params = dicts.merge(params, new_params)
super(View, self).__init__(params=params)
- def create(self, request, access_type,
- page_name=None, params=None, **kwargs):
- """On a successful post create redirects the user to the notification list.
-
- for parameters see base.create()
- """
-
- if request.method == 'POST':
- response = super(View, self).create(request, access_type,
- page_name, params, **kwargs)
-
- if (response.__class__ == http.HttpResponseRedirect and
- response['location'].startswith(
- '/%s/edit/' %(self._params['url_name']))):
- # redirect to list instead of edit view
- return http.HttpResponseRedirect('/%s/list' %(self._params['url_name']))
- else:
- return response
-
- else:
- # request.method == 'GET' so act normal
- return super(View, self).create(request, access_type,
- page_name, params, **kwargs)
-
def list(self, request, access_type,
page_name=None, params=None, seed=None, **kwargs):
"""Lists all notifications that the current logged in user has stored.