O'Reilly logo

Django 1.0 Web Site Development by Ayman Hourieh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Improving the interface with messages

Although our implementation of user networks is working correctly, there is something missing. The interface does not tell the user whether an operation succeeded or failed. After sending an invitation, for example, the user is redirected back to the invitation form, with no feedback on whether the operation was successful or not. In this section, we are going to improve our interface by providing status messages to the user after performing certain actions.

Displaying messages to users is done using the message API, which is part of the authentication system. The API is simple. To create a message, you can use the following call:

request.user.message_set.create(
  message=u'Message text goes here.'
)

This call ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required