Sharing posts by email

First, we will allow users to share posts by sending them emails. Take a short time to think how you would use views, URLs, and templates to create this functionality using what you have learned in the preceding chapter. Now, check what you need in order to allow your users to send posts by email. You will need to do the following things:

  • Create a form for users to fill in their name and email, the email recipient, and optional comments
  • Create a view in the views.py file that handles the posted data and sends the email
  • Add a URL pattern for the new view in the urls.py file of the blog application
  • Create a template to display the form

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.