Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Project Allocator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edtech
Project Allocator
Merge requests
!15
Feat: support new fields for meeting mode, proposed start date and duration.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feat: support new fields for meeting mode, proposed start date and duration.
new-project-details
into
master
Overview
0
Commits
4
Pipelines
3
Changes
12
Merged
Andrea Callia D'Iddio
requested to merge
new-project-details
into
master
2 years ago
Overview
0
Commits
4
Pipelines
3
Changes
12
Expand
As per title
0
0
Merge request reports
Compare
master
version 4
afebb22a
2 years ago
version 3
5406146c
2 years ago
version 2
5e2c56f5
2 years ago
version 1
da5aca25
2 years ago
master (base)
and
version 3
latest version
9ef5f1cb
4 commits,
2 years ago
version 4
afebb22a
3 commits,
2 years ago
version 3
5406146c
2 commits,
2 years ago
version 2
5e2c56f5
2 commits,
2 years ago
version 1
da5aca25
1 commit,
2 years ago
12 files
+
184
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
Search (e.g. *.vue) (Ctrl+P)
app/forms/project.py
+
39
−
1
Options
from
flask_wtf
import
FlaskForm
from
wtforms
import
BooleanField
,
SelectField
,
StringField
,
TextAreaField
from
wtforms
import
(
BooleanField
,
DateField
,
IntegerField
,
SelectField
,
StringField
,
TextAreaField
,
validators
,
)
from
wtforms.validators
import
DataRequired
,
ValidationError
@@ -9,6 +17,18 @@ class ProjectForm(FlaskForm):
is_student_proposal
=
BooleanField
(
"
Student Proposal
"
,
default
=
False
)
on_behalf
=
StringField
(
"
from
"
,
default
=
None
)
category
=
SelectField
(
"
Category
"
,
coerce
=
str
)
meeting_mode
=
SelectField
(
"
Meeting type
"
,
choices
=
[(
""
,
"
N/A
"
),
(
"
remote
"
,
"
Remote
"
),
(
"
in-person
"
,
"
In person
"
)],
coerce
=
str
,
validators
=
[
validators
.
Optional
()],
)
proposed_start_date
=
DateField
(
"
Proposed start date
"
,
validators
=
[
validators
.
Optional
()]
)
duration_in_weeks
=
IntegerField
(
"
Duration (in weeks)
"
,
validators
=
[
validators
.
Optional
()]
)
def
validate_on_behalf
(
self
,
field
):
if
self
.
is_student_proposal
.
data
and
not
field
.
data
:
@@ -20,3 +40,21 @@ class ProjectForm(FlaskForm):
if
field
==
self
.
category
and
field
.
data
==
""
:
self
.
category
.
errors
+=
"
Please choose a category for the project.
"
raise
ValidationError
(
"
Please choose a category for the project.
"
)
def
validate_meeting_mode
(
self
,
field
):
if
field
==
self
.
category
and
field
.
data
not
in
[
""
,
"
remote
"
,
"
in-person
"
]:
self
.
meeting_mode
.
errors
+=
"
Invalid meeting mode.
"
raise
ValidationError
(
"
The meeting mode for the project is invalid. Choose a valid value or leave it blank.
"
)
def
validate_duration
(
self
,
field
):
if
(
field
==
self
.
duration_in_weeks
and
field
.
data
is
not
None
and
field
.
data
<
0
):
self
.
meeting_mode
.
errors
+=
"
Invalid duration.
"
raise
ValidationError
(
"
The duration for the project is invalid. Choose a valid value or leave it blank.
"
)
Loading