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
!16
Feat: adding new non-mandatory fields.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feat: adding new non-mandatory fields.
adding-new-fields
into
master
Overview
0
Commits
1
Pipelines
1
Changes
7
Merged
Andrea Callia D'Iddio
requested to merge
adding-new-fields
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
7
Expand
As per title
0
0
Merge request reports
Compare
master
version 1
dc64ec98
2 years ago
master (base)
and
latest version
latest version
579d4681
1 commit,
2 years ago
version 1
dc64ec98
1 commit,
2 years ago
7 files
+
125
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
app/forms/project.py
+
37
−
19
Options
@@ -14,20 +14,54 @@ from wtforms.validators import DataRequired, ValidationError
class
ProjectForm
(
FlaskForm
):
title
=
StringField
(
"
Title
"
,
validators
=
[
DataRequired
()])
description
=
TextAreaField
(
"
Description
"
,
validators
=
[
DataRequired
()])
background_skills
=
TextAreaField
(
"
Background skills
"
)
is_student_proposal
=
BooleanField
(
"
Student Proposal
"
,
default
=
False
)
on_behalf
=
StringField
(
"
from
"
,
default
=
None
)
category
=
SelectField
(
"
Category
"
,
coerce
=
str
)
meeting_modes
=
[(
""
,
"
N/A
"
),
(
"
remote
"
,
"
Remote
"
),
(
"
in-person
"
,
"
In person
"
)]
meeting_mode
=
SelectField
(
"
Meeting type
"
,
choices
=
[(
""
,
"
N/A
"
),
(
"
remote
"
,
"
Remote
"
),
(
"
in-person
"
,
"
In person
"
)]
,
choices
=
meeting_modes
,
coerce
=
str
,
validators
=
[
validators
.
Optional
()],
validators
=
[
validators
.
Optional
(),
validators
.
AnyOf
([
c
[
0
]
for
c
in
meeting_modes
]),
],
)
proposed_start_date
=
DateField
(
"
Proposed start date
"
,
validators
=
[
validators
.
Optional
()]
)
duration_in_weeks
=
IntegerField
(
"
Duration (in weeks)
"
,
validators
=
[
validators
.
Optional
()]
"
Duration (in weeks)
"
,
validators
=
[
validators
.
Optional
(),
validators
.
NumberRange
(
min
=
0
)],
)
time_commitments
=
[
(
""
,
"
N/A
"
),
(
"
full-time
"
,
"
Full-time
"
),
(
"
part-time
"
,
"
Part-time
"
),
]
time_commitment
=
SelectField
(
"
Time Commitment
"
,
choices
=
time_commitments
,
coerce
=
str
,
validators
=
[
validators
.
Optional
(),
validators
.
AnyOf
([
c
[
0
]
for
c
in
time_commitments
]),
],
)
lab_usages
=
[
(
""
,
"
N/A
"
),
(
"
lab-based
"
,
"
Lab-based project
"
),
(
"
non-lab-based
"
,
"
Not lab-based
"
),
]
lab_usage
=
SelectField
(
"
Lab usage
"
,
choices
=
lab_usages
,
coerce
=
str
,
validators
=
[
validators
.
Optional
(),
validators
.
AnyOf
([
c
[
0
]
for
c
in
lab_usages
]),
],
)
def
validate_on_behalf
(
self
,
field
):
@@ -40,19 +74,3 @@ 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
all
(
(
field
==
self
.
duration_in_weeks
,
field
.
data
is
not
None
,
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