-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebForms.py
53 lines (38 loc) · 1.82 KB
/
WebForms.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from flask_wtf import FlaskForm
from wtforms import StringField , SubmitField , PasswordField,BooleanField,ValidationError,TextAreaField
from wtforms.validators import DataRequired,EqualTo,Length
from wtforms.widgets import TextArea
from flask_ckeditor import CKEditorField
from flask_wtf.file import FileField
#Create a Login Form
class LoginForm(FlaskForm):
username = StringField("Username",validators=[DataRequired()])
password = PasswordField("Password",validators=[DataRequired()])
submit = SubmitField("Submit")
#Create a SearchForm
class SearchForm(FlaskForm):
searched = StringField("Searched" , validators=[DataRequired(),Length(min=1)])
submit = SubmitField("Submit")
#Create a Post Form
class PostForm(FlaskForm):
title = StringField('Title',validators=[DataRequired()])
# content = StringField('Content',validators=[DataRequired()],widget=TextArea())
content = CKEditorField('Content',validators=[DataRequired()])
author = StringField('Author')
img_url = StringField('Image URL')
slug = StringField('Slug',validators=[DataRequired()])
submit = SubmitField('Submit')
#create a Form Class
# CSFIR tokens
class UserForm(FlaskForm):
name = StringField("Name" , validators= [DataRequired()])
username = StringField("UserName" , validators= [DataRequired()])
email = StringField("Email" , validators= [DataRequired()])
favorite_color = StringField('Favorite Color')
about_author = TextAreaField('About Author')
profile_pic = FileField("Profile Pic")
password_hash = PasswordField('Password',validators=[DataRequired(),EqualTo('password_hash2',message='Passwords Must Match')])
password_hash2 = PasswordField('Confirm Password',validators=[DataRequired()])
submit = SubmitField("Submit")
class Followforms(FlaskForm):
submit = SubmitField('Submit')