Book Image

Learning Website Development with Django

Book Image

Learning Website Development with Django

Overview of this book

Table of Contents (18 chapters)
Learning Website Development with Django
Credits
About the Author
About the Reviewers
Preface
Index

Message System


Our application allows users to add each other as friends and monitor friend bookmarks. Although these two forms of communication are related to the nature of our bookmarking application, sometimes users want the flexibility of sending private messages to each other. This feature is especially useful for enhancing the social aspect of our website.

The message system can be implemented in a variety of ways. It can be as simple as providing each user with a contact form, which works by sending its content to the user's email when it is submitted. You already have all of the information needed to build the components of this functionality:

  • A message form with a text field for the subject, and a text area for the body of the message.

  • A view that displays the message form of a user, and sends the contents of the form to the user via the send_mail function.

When allowing users to send emails via your site, you need to be careful in order to prevent abuse of the feature. Here you can...