diff options
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 ---------------- |