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
cf78b624
Verified
Commit
cf78b624
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Make model Mensa extensible
parent
30a00aa3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/mensa/migrations/0002_extensible_model_as_default.py
+19
-0
19 additions, 0 deletions
...apps/mensa/migrations/0002_extensible_model_as_default.py
aleksis/apps/mensa/models.py
+2
-1
2 additions, 1 deletion
aleksis/apps/mensa/models.py
with
21 additions
and
1 deletion
aleksis/apps/mensa/migrations/0002_extensible_model_as_default.py
0 → 100644
+
19
−
0
View file @
cf78b624
# Generated by Django 3.0.3 on 2020-02-25 15:40
import
django.contrib.postgres.fields.jsonb
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
mensa
'
,
'
0001_initial
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
menu
'
,
name
=
'
extended_data
'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
,
editable
=
False
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/mensa/models.py
+
2
−
1
View file @
cf78b624
from
django.db
import
models
# Create your models here.
from
aleksis.core.mixins
import
ExtensibleModel
from
aleksis.core.util.core_helpers
import
path_and_rename
from
django.utils.translation
import
gettext_lazy
as
_
...
...
@@ -9,7 +10,7 @@ def path_and_rename_menu(instance, filename: str) -> str:
return
path_and_rename
(
instance
,
filename
,
upload_to
=
"
menu
"
)
class
Menu
(
models
.
Model
):
class
Menu
(
Extensible
Model
):
calendar_week
=
models
.
IntegerField
(
verbose_name
=
_
(
"
CW
"
))
year
=
models
.
IntegerField
(
verbose_name
=
_
(
"
Year
"
))
pdf
=
models
.
FileField
(
upload_to
=
path_and_rename_menu
,
verbose_name
=
_
(
"
PDF
"
))
...
...
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