diff options
author | ankitjavalkar | 2017-06-30 19:15:04 +0530 |
---|---|---|
committer | GitHub | 2017-06-30 19:15:04 +0530 |
commit | 6a33a2a2dca1f0a5b743184a8af3536dc22e7a94 (patch) | |
tree | ba844c5e0f15c4d04eecd3eef9e5bb8ee42a6a6b /tutorial_8_django_forms | |
parent | 358d6765add7a4be60971d72d62cc9bcf8db5948 (diff) | |
download | learn_django-6a33a2a2dca1f0a5b743184a8af3536dc22e7a94.tar.gz learn_django-6a33a2a2dca1f0a5b743184a8af3536dc22e7a94.tar.bz2 learn_django-6a33a2a2dca1f0a5b743184a8af3536dc22e7a94.zip |
Update forms.py code
Diffstat (limited to 'tutorial_8_django_forms')
-rw-r--r-- | tutorial_8_django_forms/slides.md | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tutorial_8_django_forms/slides.md b/tutorial_8_django_forms/slides.md index c05ea41..1caf256 100644 --- a/tutorial_8_django_forms/slides.md +++ b/tutorial_8_django_forms/slides.md @@ -52,11 +52,19 @@ Slide 6 Slide 7 ---------------- -**Creating a New Form** - -- Create a forms.py in the ```blog``` - - +**Creating a New Form for Blogs** + +- Create a forms.py in the ```blog``` and add the code + + class BlogForm(ModelForm): + class Meta: + model = Blog + fields = ['name', 'created_on'] + + class ArticleForm(ModelForm): + class Meta: + model = Article + fields = ['created_on', 'title', 'body', 'draft'] Slide 8 ---------------- |