#8684: Adding custom (succes/failure) messages to the admin site
--------------------------------------+-------------------------------------
Reporter: metzeltiger | Owner: nobody
Status: closed | Milestone:
Component: Admin interface | Version:
Resolution: invalid | Keywords: message, notification
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
--------------------------------------+-------------------------------------
Changes (by kratorius):
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
You can do this by overriding {{{ModelAdmin.response_add()}}} (or
{{{.response_change}}}), so closing as invalid. Follows an example, just
for future reference:
{{{
#!python
class TestAdmin(admin.ModelAdmin):
def response_add(self, request, obj, post_url_continue='../%s/'):
ret = super(Model1Admin, self).response_add(request, obj,
post_url_continue)
request.user.get_and_delete_messages()
request.user.message_set.create(
message="Your custom message here"
)
return ret
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/8684#comment:1>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---