Skip to Main Content
Hands-On Application Development with PyCharm
book

Hands-On Application Development with PyCharm

by Quan Nguyen
September 2019
Beginner to intermediate content levelBeginner to intermediate
494 pages
13h
English
Packt Publishing
Content preview from Hands-On Application Development with PyCharm

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MASTERING PYCHARM

MASTERING PYCHARM

Nafiul Islam

Publisher Resources

ISBN: 9781789348262Supplemental Content