Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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
Container Registry
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-Alsijil
Commits
f1b6dd99
Verified
Commit
f1b6dd99
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add extra mark model
parent
de461c45
No related branches found
No related tags found
1 merge request
!68
Resolve "Add option to configure extra marks for personal notes"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/migrations/0002_extra_mark.py
+72
-0
72 additions, 0 deletions
aleksis/apps/alsijil/migrations/0002_extra_mark.py
aleksis/apps/alsijil/models.py
+28
-0
28 additions, 0 deletions
aleksis/apps/alsijil/models.py
with
100 additions
and
0 deletions
aleksis/apps/alsijil/migrations/0002_extra_mark.py
0 → 100644
+
72
−
0
View file @
f1b6dd99
# Generated by Django 3.0.8 on 2020-07-12 12:43
import
django.contrib.postgres.fields.jsonb
import
django.contrib.sites.managers
import
django.db.models.deletion
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"
sites
"
,
"
0002_alter_domain_unique
"
),
(
"
alsijil
"
,
"
0001_initial
"
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
"
ExtraMark
"
,
fields
=
[
(
"
id
"
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
"
ID
"
,
),
),
(
"
extended_data
"
,
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
,
editable
=
False
),
),
(
"
short_name
"
,
models
.
CharField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
"
Short name
"
),
),
(
"
name
"
,
models
.
CharField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
"
Name
"
),
),
(
"
site
"
,
models
.
ForeignKey
(
default
=
1
,
editable
=
False
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
"
sites.Site
"
,
),
),
],
options
=
{
"
verbose_name
"
:
"
Extra mark
"
,
"
verbose_name_plural
"
:
"
Extra marks
"
,
"
ordering
"
:
[
"
short_name
"
],
},
managers
=
[(
"
objects
"
,
django
.
contrib
.
sites
.
managers
.
CurrentSiteManager
()),],
),
migrations
.
AddField
(
model_name
=
"
personalnote
"
,
name
=
"
extra_marks
"
,
field
=
models
.
ManyToManyField
(
blank
=
True
,
null
=
True
,
to
=
"
alsijil.ExtraMark
"
,
verbose_name
=
"
Extra marks
"
,
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/models.py
+
28
−
0
View file @
f1b6dd99
...
...
@@ -30,6 +30,10 @@ class PersonalNote(ExtensibleModel):
remarks
=
models
.
CharField
(
max_length
=
200
,
blank
=
True
)
extra_marks
=
models
.
ManyToManyField
(
"
ExtraMark
"
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
"
Extra marks
"
)
)
class
Meta
:
verbose_name
=
_
(
"
Personal note
"
)
verbose_name_plural
=
_
(
"
Personal notes
"
)
...
...
@@ -91,3 +95,27 @@ class PersonalNoteFilter(ExtensibleModel):
verbose_name
=
_
(
"
Personal note filter
"
)
verbose_name_plural
=
_
(
"
Personal note filters
"
)
ordering
=
[
"
identifier
"
]
class
ExtraMark
(
ExtensibleModel
):
"""
A model for extra marks.
Can be used for lesson-based counting of things (like forgotten homework).
"""
short_name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
_
(
"
Short name
"
)
)
name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
_
(
"
Name
"
))
def
__str__
(
self
):
return
f
"
{
self
.
name
}
(
{
self
.
short_name
}
)
"
@property
def
count_label
(
self
):
return
f
"
{
self
.
short_name
}
_count
"
class
Meta
:
ordering
=
[
"
short_name
"
]
verbose_name
=
_
(
"
Extra mark
"
)
verbose_name_plural
=
_
(
"
Extra marks
"
)
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