Creating the interface for the share feature

We will implement the form feature, which, in essence, is another view in our blog application. To do this, perform the following steps:

  1. First, create a new Python script inside the blog folder in the forms.py directory, as follows:
from django import formsclass EmailPostForm(forms.Form):    name = forms.CharField(max_length=25)    email = forms.EmailField()    to = forms.EmailField()    comments = forms.CharField(required=False, widget=forms.Textarea)

You can see that this file resembles a model declaration in Django; while the basic implementation is similar, Django forms are organized in the forms.py directory, separate from models. Here, we can see that, once again, Django offers an easy and straightforward ...

Get Hands-On Application Development with PyCharm 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.