Fixed #11470 - add documentation for ModelAdmin.message_user. thanks adamv.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Timo Graham 2010-12-11 13:51:14 +00:00
parent f0753ef211
commit 82f2daaf45
2 changed files with 8 additions and 0 deletions

View File

@ -175,6 +175,8 @@ Defining actions as methods gives the action more straightforward, idiomatic
access to the :class:`ModelAdmin` itself, allowing the action to call any of the access to the :class:`ModelAdmin` itself, allowing the action to call any of the
methods provided by the admin. methods provided by the admin.
.. _custom-admin-action:
For example, we can use ``self`` to flash a message to the user informing her For example, we can use ``self`` to flash a message to the user informing her
that the action was successful:: that the action was successful::

View File

@ -933,6 +933,12 @@ templates used by the :class:`ModelAdmin` views:
return qs return qs
return qs.filter(author=request.user) return qs.filter(author=request.user)
.. method:: ModelAdmin.message_user(request, message)
Sends a message to the user. The default implementation creates a message
using the :mod:`django.contrib.messages` backend. See the
:ref:`custom ModelAdmin example <custom-admin-action>`.
Other methods Other methods
~~~~~~~~~~~~~ ~~~~~~~~~~~~~