generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforms.py
31 lines (20 loc) · 722 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django import forms
from .models import Post, User, Comment
class PostForm(forms.ModelForm):
""" Class for making forms posts"""
class Meta:
model = Post
fields = ("topic", "title", "content",)
widgets = {
"topic": forms.Select(attrs={'class': 'form-control'}),
"title": forms.TextInput(attrs={'class': 'form-control'}),
"content": forms.Textarea(attrs={'class': 'form-control'}),
}
class CommentForm(forms.ModelForm):
""" Class for making form comments"""
class Meta:
model = Comment
fields = ('body',)
widgets = {
"body": forms.Textarea(attrs={'class': 'form-control'}),
}