Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TIC-Desk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Teckids
TIC-Desk
Commits
0a6f4e5f
Verified
Commit
0a6f4e5f
authored
4 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Add member information fields. Advances
#86
parent
3ff2046d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!55
WIP: Resolve "Migrate to AlekSIS app"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/ticdesk_org/model_extensions.py
+41
-2
41 additions, 2 deletions
aleksis/apps/ticdesk_org/model_extensions.py
with
41 additions
and
2 deletions
aleksis/apps/ticdesk_org/model_extensions.py
+
41
−
2
View file @
0a6f4e5f
from
jsonstore
import
CharField
from
django.utils
import
timezone
from
django.utils.translation
import
gettext_lazy
as
_
from
jsonstore
import
CharField
,
IntegerField
,
DateField
from
aleksis.core.models
import
Person
from
aleksis.core.models
import
Person
,
Group
@Person.property
def
is_member_of
(
self
,
group
):
"""
Check if person is member of a given group
"""
return
group
in
self
.
groups
@Person.property
def
is_member
(
self
):
"""
Check if person is still a member
"""
now
=
timezone
.
datetime
.
now
().
date
()
members
=
Groups
.
objects
.
get
(
short_name
=
"
members
"
)
return
(
self
.
is_member_of
(
members
)
and
(
self
.
member_since
and
self
.
member_since
<=
now
)
and
(
not
self
.
member_until
or
self
.
member_until
>=
now
)
)
# Field for school
Person
.
field
(
school
=
CharField
(
verbose_name
=
_
(
"
Name of school
"
)))
Person
.
field
(
school_class
=
CharField
(
verbose_name
=
_
(
"
School class
"
)))
Person
.
field
(
school_place
=
CharField
(
verbose_name
=
_
(
"
Place of the school
"
)))
# Member information
Person
.
field
(
employee_number
=
IntegerField
(
verbose_name
=
_
(
"
Employee number
"
),
blank
=
True
,
null
=
True
)
)
Person
.
field
(
member_since
=
DateField
(
verbose_name
=
_
(
"
Member since
"
),
blank
=
True
,
null
=
True
)
)
Person
.
field
(
member_until
=
DateField
(
verbose_name
=
_
(
"
Member until
"
),
blank
=
True
,
null
=
True
)
)
Person
.
field
(
iban
=
CharField
(
verbose_name
=
_
(
"
IBAN
"
),
blank
=
True
,
null
=
True
))
Person
.
field
(
bic
=
CharField
(
verbose_name
=
_
(
"
BIC
"
),
blank
=
True
,
null
=
True
))
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