Ticket #11470: admin-send-message.diff

File admin-send-message.diff, 1.2 KB (added by Adam Vandenberg, 13 years ago)

Draft documentation for this method.

  • docs/ref/contrib/admin/actions.txt

    diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt
    index 86a5355..0fab59e 100644
    a b Defining actions as methods gives the action more straightforward, idiomatic  
    175175access to the :class:`ModelAdmin` itself, allowing the action to call any of the
    176176methods provided by the admin.
    177177
     178.. _custom-admin-action:
     179
    178180For example, we can use ``self`` to flash a message to the user informing her
    179181that the action was successful::
    180182
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    index 4c72cf1..63429c0 100644
    a b templates used by the :class:`ModelAdmin` views:  
    933933                    return qs
    934934                return qs.filter(author=request.user)
    935935
     936.. method:: ModelAdmin.message_user(request, message)
     937
     938    Sends a message to the user. The default implementation posts a message
     939    using the :mod:`django.contrib.messages` backend. See the
     940    :ref:`custom ModelAdmin example <custom-admin-action>`.
     941
    936942Other methods
    937943~~~~~~~~~~~~~
    938944
Back to Top