diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-04-07 22:01:23 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-04-07 22:01:23 +0000 |
| commit | 8d4b414760fdd677c973f9ccfe4f5c3b41934d4d (patch) | |
| tree | d349e5999688aea533b298db890ff883bcef33a8 /docs/topics | |
| parent | b7715b4ae68be211749520e60c63d251ccf14bc1 (diff) | |
Fixed #15757 - removed remaining instances of get_and_delete_messages
Thanks to void for the report, and julien for the bulk of the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/auth.txt | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 4a8d63f62b..c01079c82a 100644 --- a/docs/topics/auth.txt +++ b/docs/topics/auth.txt @@ -19,10 +19,6 @@ The auth system consists of: a certain task. * Groups: A generic way of applying labels and permissions to more than one user. - * Messages: A simple way to queue messages for given users. - -.. deprecated:: 1.2 - The Messages component of the auth system will be removed in Django 1.4. Installation ============ @@ -256,11 +252,6 @@ Methods (the Django app label). If the user is inactive, this method will always return ``False``. - .. method:: models.User.get_and_delete_messages() - - Returns a list of :class:`~django.contrib.auth.models.Message` objects - in the user's queue and deletes the messages from the queue. - .. method:: models.User.email_user(subject, message, from_email=None) Sends an email to the user. If @@ -1387,70 +1378,6 @@ group ``'Special users'``, and you could write code that could, say, give them access to a members-only portion of your site, or send them members-only email messages. -Messages -======== - -.. deprecated:: 1.2 - This functionality will be removed in Django 1.4. You should use the - :doc:`messages framework </ref/contrib/messages>` for all new projects and - begin to update your existing code immediately. - -The message system is a lightweight way to queue messages for given users. - -A message is associated with a :class:`~django.contrib.auth.models.User`. -There's no concept of expiration or timestamps. - -Messages are used by the Django admin after successful actions. For example, -``"The poll Foo was created successfully."`` is a message. - -The API is simple: - -.. method:: models.User.message_set.create(message) - - To create a new message, use - ``user_obj.message_set.create(message='message_text')``. - - To retrieve/delete messages, use - :meth:`user_obj.get_and_delete_messages() <django.contrib.auth.models.User.get_and_delete_messages>`, - which returns a list of ``Message`` objects in the user's queue (if any) - and deletes the messages from the queue. - -In this example view, the system saves a message for the user after creating -a playlist:: - - def create_playlist(request, songs): - # Create the playlist with the given songs. - # ... - request.user.message_set.create(message="Your playlist was added successfully.") - return render_to_response("playlists/create.html", - context_instance=RequestContext(request)) - -When you use :class:`~django.template.context.RequestContext`, the currently -logged-in user and his/her messages are made available in the -:doc:`template context </ref/templates/api>` as the template variable -``{{ messages }}``. Here's an example of template code that displays messages: - -.. code-block:: html+django - - {% if messages %} - <ul> - {% for message in messages %} - <li>{{ message }}</li> - {% endfor %} - </ul> - {% endif %} - -.. versionchanged:: 1.2 - The ``messages`` template variable uses a backwards compatible method in the - :doc:`messages framework </ref/contrib/messages>` to retrieve messages from - both the user ``Message`` model and from the new framework. Unlike in - previous revisions, the messages will not be erased unless they are actually - displayed. - -Finally, note that this messages framework only works with users in the user -database. To send messages to anonymous users, use the -:doc:`messages framework </ref/contrib/messages>`. - .. _authentication-backends: Other authentication sources |
