Recommending posts by email
Now, we will learn how to create forms and how to send emails with Django. We will allow users to share blog posts with others by sending post recommendations via email.
Take a minute to think about how you could use views, URLs, and templates to create this functionality using what you learned in the preceding chapter.
To allow users to share posts via email, we will need to:
- Create a form for users to fill in their name, their email address, the recipient email address, 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
Creating forms with Django
Let’s start by building the form to share posts. Django has a built-in forms framework that allows you to create forms easily. The forms framework makes it simple to define the...