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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
9802fdd1
Commit
9802fdd1
authored
2 years ago
by
Dana Meyer
Browse files
Options
Downloads
Patches
Plain Diff
Add form and template for adding a model.
parent
61098535
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/contributions/forms.py
+75
-0
75 additions, 0 deletions
app/contributions/forms.py
app/contributions/routes.py
+9
-2
9 additions, 2 deletions
app/contributions/routes.py
app/templates/contributions/contribute.html.j2
+32
-0
32 additions, 0 deletions
app/templates/contributions/contribute.html.j2
with
116 additions
and
2 deletions
app/contributions/forms.py
0 → 100644
+
75
−
0
View file @
9802fdd1
from
flask_wtf
import
FlaskForm
from
wtforms
import
(
BooleanField
,
PasswordField
,
StringField
,
SubmitField
,
SelectMultipleField
,
ValidationError
,
FieldList
,
IntegerField
)
from
wtforms.validators
import
InputRequired
,
Email
,
EqualTo
,
Length
,
Regexp
from
app.models
import
User
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
"
]
)
# 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
()]
)
submit
=
SubmitField
()
This diff is collapsed.
Click to expand it.
app/contributions/routes.py
+
9
−
2
View file @
9802fdd1
from
flask
import
render_template
from
flask_login
import
login_required
from
flask_login
import
login_required
from
app.decorators
import
permission_required
from
app.decorators
import
permission_required
from
app.models
import
Permission
from
app.models
import
Permission
from
.
import
bp
from
.
import
bp
from
.forms
import
ContributionForm
@bp.before_request
@bp.before_request
...
@@ -11,6 +13,11 @@ def before_request():
...
@@ -11,6 +13,11 @@ def before_request():
pass
pass
@bp.route
(
''
)
@bp.route
(
''
,
methods
=
[
'
GET
'
,
'
POST
'
]
)
def
contributions
():
def
contributions
():
pass
form
=
ContributionForm
(
prefix
=
'
contribution-form
'
)
return
render_template
(
'
contributions/contribute.html.j2
'
,
form
=
form
,
title
=
'
Contribution
'
)
This diff is collapsed.
Click to expand it.
app/templates/contributions/contribute.html.j2
0 → 100644
+
32
−
0
View file @
9802fdd1
{% extends "base.html.j2" %}
{% import "materialize/wtf.html.j2" as wtf %}
{% block page_content %}
<div class="container">
<div class="row">
<div class="col s12 m8 offset-m2">
<h1 id="title">{{ title }}</h1>
<p>
In order to add a new model, please fill in the form below.
</p>
<form method="POST">
<div class="card-panel">
{{ form.hidden_tag() }}
{{ wtf.render_field(form.title) }}
{{ wtf.render_field(form.description) }}
{{ wtf.render_field(form.publisher) }}
{{ wtf.render_field(form.publisher_url) }}
{{ wtf.render_field(form.publishing_url) }}
{{ wtf.render_field(form.publishing_year) }}
{{ wtf.render_field(form.shared) }}
{{ wtf.render_field(form.version) }}
{{ wtf.render_field(form.compatible_service_versions) }}
{{ wtf.render_field(form.submit, class_='width-100', material_icon='send') }}
</div>
</form>
</div>
</div>
{% endblock page_content %}
\ No newline at end of file
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