1+ from flask_wtf import FlaskForm
2+ from wtforms import RadioField , SelectField , SelectMultipleField , widgets , SubmitField
3+ from wtforms import StringField , PasswordField , SubmitField
4+ from wtforms .validators import DataRequired , Length , EqualTo , Email , Optional
5+ from wtforms .validators import URL
6+
7+ class MultiCheckboxField (SelectMultipleField ):
8+ widget = widgets .ListWidget (prefix_label = False )
9+ option_widget = widgets .CheckboxInput ()
10+
11+ class SurveyForm (FlaskForm ):
12+ class_section = RadioField ('Which class and section are you in?' , choices = [
13+ ('9A' , '9A' ), ('9B' , '9B' ), ('9C' , '9V' ), ('9D' , '9G' )
14+ ])
15+
16+ study_time = RadioField ('How many hours a day do you study outside school?' , choices = [
17+ ('under_1' , 'Less than 1 hour' ),
18+ ('1_2' , '1–2 hours' ),
19+ ('2_3' , '2–3 hours' ),
20+ ('over_3' , 'More than 3 hours' )
21+ ])
22+
23+ interest_level = RadioField ('How interested are you in the school material?' , choices = [
24+ ('very_high' , 'Very high' ),
25+ ('medium' , 'Medium' ),
26+ ('low' , 'Low' ),
27+ ('none' , 'Not interested' )
28+ ])
29+
30+ confidence = RadioField ('How confident do you feel before tests/exams?' , choices = [
31+ ('very' , 'Very confident' ),
32+ ('moderate' , 'Moderately confident' ),
33+ ('low' , 'Not very confident' ),
34+ ('stressed' , 'Stressed' )
35+ ])
36+
37+ memory_method = RadioField ('What’s your easiest way to remember information?' , choices = [
38+ ('notes' , 'Taking notes' ),
39+ ('videos' , 'Watching videos' ),
40+ ('repetition' , 'Repeating information' )
41+ ])
42+
43+ online_learning = RadioField ('How often do you use online learning resources?' , choices = [
44+ ('daily' , 'Daily' ),
45+ ('few_times' , 'Several times a week' ),
46+ ('rarely' , 'Rarely' ),
47+ ('never' , 'Never' )
48+ ])
49+
50+ hardest_subject = SelectField ('Which subject do you find most difficult?' , choices = [
51+ ('Natural sciences' , 'Natural sciences' ),
52+ ('mathematics' , 'Mathematics' ),
53+ ('languages' , 'Languages' ),
54+ ('social sciences' , 'Social sciences' ),
55+ ('other' , 'Other' )
56+ ])
57+
58+ favorite_subject = SelectField ('What is your favorite school subject?' , choices = [
59+ ('Natural sciences' , 'Natural sciences' ),
60+ ('mathematics' , 'Mathematics' ),
61+ ('languages' , 'Languages' ),
62+ ('social sciences' , 'Social sciences' ),
63+ ('other' , 'Other' )
64+ ])
65+
66+ social_time = RadioField ('How much time do you spend on social media/games daily?' , choices = [
67+ ('under_1' , 'Less than 1 hour' ),
68+ ('1_3' , '1–3 hours' ),
69+ ('over_3' , 'More than 3 hours' )
70+ ])
71+
72+ video_platforms = MultiCheckboxField ('Which platforms do you use most for video lessons?' , choices = [
73+ ('youtube' , 'YouTube' ),
74+ ('ucha_se' , 'Ucha.se' ),
75+ ('khan' , 'Khan Academy' ),
76+ ('online_school' , 'Online School' )
77+ ])
78+
79+ video_helpful = RadioField ('Do video lessons help you understand the material better?' , choices = [
80+ ('very' , 'Very much' ),
81+ ('somewhat' , 'Somewhat' ),
82+ ('not_much' , 'Not really' ),
83+ ('not_at_all' , 'Not at all' )
84+ ])
85+
86+ lesson_quality = MultiCheckboxField ('What are the most important qualities of a good video lesson?' , choices = [
87+ ('short_clear' , 'Short and clear' ),
88+ ('examples' , 'With examples and exercises' ),
89+ ('visuals' , 'With visuals and animations' ),
90+ ('slow_clear' , 'Explained slowly and clearly' )
91+ ])
92+
93+ ideal_length = RadioField ('What is the ideal length of a video lesson?' , choices = [
94+ ('under_5' , 'Less than 5 minutes' ),
95+ ('5_10' , '5–10 minutes' ),
96+ ('10_20' , '10–20 minutes' ),
97+ ('doesnt_matter' , 'Doesn’t matter as long as it’s useful' )
98+ ])
99+
100+ videos_for_tests = RadioField ('Do you watch video lessons when preparing for tests?' , choices = [
101+ ('always' , 'Always' ),
102+ ('sometimes' , 'Sometimes' ),
103+ ('only_if_needed' , 'Only if I don’t understand' ),
104+ ('never' , 'Never' )
105+ ])
106+
107+ review_before_class = RadioField ('How often do you review lessons before class?' , choices = [
108+ ('always' , 'Always' ),
109+ ('sometimes' , 'Sometimes' ),
110+ ('never' , 'Never' )
111+ ])
112+
113+ submit = SubmitField ('Submit' )
114+
115+
116+ class SettingsForm (FlaskForm ):
117+ username = StringField ('Username' , validators = [DataRequired ()])
118+ email = StringField ('Email' , validators = [DataRequired (), Email ()])
119+ current_password = PasswordField ('Current Password' , validators = [Optional ()])
120+ new_password = PasswordField ('New Password' , validators = [Optional ()])
121+ confirm_password = PasswordField ('Confirm New Password' , validators = [
122+ Optional (),
123+ EqualTo ('new_password' , message = 'Passwords must match' )
124+ ])
125+ submit = SubmitField ('Save Changes' )
126+ class VideoSubmissionForm (FlaskForm ):
127+ video_link = StringField ('Video Link' , validators = [
128+ DataRequired (), URL (), Length (max = 500 )
129+ ])
130+ submit = SubmitField ('Submit' )
0 commit comments