Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Resint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Resint
Commits
f28b8f38
Verified
Commit
f28b8f38
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Use material form to render upload form
parent
5cad4d11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/mensa/forms.py
+6
-2
6 additions, 2 deletions
aleksis/apps/mensa/forms.py
aleksis/apps/mensa/templates/mensa/upload.html
+7
-32
7 additions, 32 deletions
aleksis/apps/mensa/templates/mensa/upload.html
with
13 additions
and
34 deletions
aleksis/apps/mensa/forms.py
+
6
−
2
View file @
f28b8f38
from
django
import
forms
from
django.core.validators
import
FileExtensionValidator
from
django.utils
import
timezone
from
material
import
Layout
,
Row
from
.models
import
Menu
...
...
@@ -15,12 +16,15 @@ class MenuUploadForm(forms.ModelForm):
year
=
forms
.
ChoiceField
(
initial
=
timezone
.
datetime
.
now
().
year
,
choices
=
options_for_year
)
pdf
=
forms
.
FileField
(
label
=
"
PDF-Datei
"
,
validators
=
[
FileExtensionValidator
(
allowed_extensions
=
[
"
pdf
"
])],
)
layout
=
Layout
(
Row
(
"
calendar_week
"
,
"
year
"
),
Row
(
"
pdf
"
)
)
class
Meta
:
model
=
Menu
fields
=
(
"
calendar_week
"
,
"
year
"
,
"
pdf
"
)
This diff is collapsed.
Click to expand it.
aleksis/apps/mensa/templates/mensa/upload.html
+
7
−
32
View file @
f28b8f38
{% extends "core/base.html" %}
{% load msg_box %}
{% load msg_box i18n material_form %}
{% block page_title %}{% trans "Upload menu" %}{% endblock %}
{% block content %}
<h5>
Speiseplan hochladen
</h5>
<form
method=
"post"
enctype=
"multipart/form-data"
>
{% csrf_token %}
{% msg_box form.non_field_errors "error" "error" %}
<div
class=
"row"
>
<div
class=
"input-field col s5"
>
{% msg_box form.calendar_week.errors "error" "error" %}
<small>
Kalenderwoche
</small>
{{ form.calendar_week }}
</div>
<div
class=
"col s2 center-align"
>
<small>
</small>
<h4>
/
</h4>
</div>
<div
class=
"input-field col s5"
>
{% msg_box form.year.errors "error" "error" %}
<small>
Jahr
</small>
{{ form.year }}
</div>
</div>
<div
class=
"file-field input-field"
>
{% msg_box form.pdf.errors "error" "error" %}
<div
class=
"btn"
>
<span><i
class=
"material-icons center"
>
cloud_upload
</i></span>
<input
type=
"file"
name=
"{{ form.pdf.html_name }}"
>
</div>
<div
class=
"file-path-wrapper"
>
<input
class=
"file-path validate"
type=
"text"
>
</div>
</div>
{% form form=form %}{% endform %}
<button
class=
"waves-effect waves-light btn green"
type=
"submit"
>
<i
class=
"material-icons left"
>
cloud_upload
</i>
Speiseplan hochladen und veröffentlichen
{% trans "Upload and publish menu" %}
</button>
</form>
<p>
<a
href=
"{% url 'menu_index' %}"
class=
"waves-effect waves-teal btn-flat"
>
Zurück zur Übersicht
</a>
<a
href=
"{% url 'menu_index' %}"
class=
"waves-effect waves-teal btn-flat"
>
{% trans "Back to overview" %}
</a>
</p>
{% endblock %}
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