Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
36d3ea2c
Commit
36d3ea2c
authored
2 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Remove helper comments and add service versions dynamically to select.
parent
40a71ad9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/contributions/forms.py
+14
-38
14 additions, 38 deletions
app/contributions/forms.py
with
14 additions
and
38 deletions
app/contributions/forms.py
+
14
−
38
View file @
36d3ea2c
...
...
@@ -2,81 +2,57 @@ from flask_wtf import FlaskForm
from
flask_wtf.file
import
FileField
,
FileRequired
from
wtforms
import
(
BooleanField
,
PasswordField
,
StringField
,
SubmitField
,
SelectMultipleField
,
ValidationError
,
FieldList
,
IntegerField
IntegerField
)
from
wtforms.validators
import
InputRequired
,
Email
,
EqualTo
,
Length
,
Regexp
from
app.
model
s
import
User
from
wtforms.validators
import
InputRequired
,
Length
from
app.
service
s
import
SERVICES
class
ContributionForm
(
FlaskForm
):
# The id field will be generated on insert.
# The user_id will be retrieved from the user who is performing this operation.
# title = db.Column(db.String(64))
title
=
StringField
(
'
Title
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
64
)]
)
# description = db.Column(db.String(255))
description
=
StringField
(
'
Description
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
255
)]
)
# version = db.Column(db.String(16))
version
=
StringField
(
'
Version
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
16
)]
)
# compatible_service_versions = db.Column(ContainerColumn(list, 255))
compatible_service_versions
=
SelectMultipleField
(
'
Compatible Service Versions
'
,
choices
=
[
"
asd
"
,
"
blub
"
,
"
bla
"
]
'
Compatible service versions
'
)
# publisher = db.Column(db.String(128))
publisher
=
StringField
(
'
Publisher
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
128
)]
)
# publisher_url = db.Column(db.String(512))
publisher_url
=
StringField
(
'
Publisher URL
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
512
)]
)
# publishing_url = db.Column(db.String(512))
publishing_url
=
StringField
(
'
Publishing URL
'
,
validators
=
[
InputRequired
(),
Length
(
max
=
512
)]
)
# publishing_year = db.Column(db.Integer)
publishing_year
=
IntegerField
(
'
Publishing year
'
,
validators
=
[
InputRequired
()]
)
# shared = db.Column(db.Boolean, default=False)
shared
=
BooleanField
(
'
Shared
'
,
validators
=
[
InputRequired
()]
)
# file upload
file
=
FileField
(
'
File
'
,
validators
=
[
FileRequired
()]
)
shared
=
BooleanField
(
'
Shared
'
,
validators
=
[
InputRequired
()])
model_file
=
FileField
(
'
File
'
,
validators
=
[
FileRequired
()])
submit
=
SubmitField
()
def
__init__
(
self
,
*
args
,
**
kwargs
):
service_manifest
=
SERVICES
[
'
tesseract-ocr-pipeline
'
]
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
compatible_service_versions
.
choices
=
[(
''
,
'
Choose your option
'
)]
self
.
compatible_service_versions
.
choices
+=
[
(
x
,
x
)
for
x
in
service_manifest
[
'
versions
'
].
keys
()
]
self
.
compatible_service_versions
.
default
=
''
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment