Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
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
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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-Core
Commits
e5e33374
Verified
Commit
e5e33374
authored
4 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Fix name of decorator
parent
6210ae04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/models.py
+8
-8
8 additions, 8 deletions
aleksis/core/models.py
with
8 additions
and
8 deletions
aleksis/core/models.py
+
8
−
8
View file @
e5e33374
...
...
@@ -117,7 +117,7 @@ class Person(ExtensibleModel):
def
get_absolute_url
(
self
)
->
str
:
return
reverse
(
"
person_by_id
"
,
args
=
[
self
.
id
])
@property
_
@property
def
primary_group_short_name
(
self
)
->
Optional
[
str
]:
"""
Return the short_name field of the primary group related object.
"""
if
self
.
primary_group
:
...
...
@@ -135,12 +135,12 @@ class Person(ExtensibleModel):
group
,
created
=
Group
.
objects
.
get_or_create
(
short_name
=
value
,
defaults
=
{
"
name
"
:
value
})
self
.
primary_group
=
group
@property
_
@property
def
full_name
(
self
)
->
str
:
"""
Full name of person in last name, first name order.
"""
return
f
"
{
self
.
last_name
}
,
{
self
.
first_name
}
"
@property
_
@property
def
adressing_name
(
self
)
->
str
:
"""
Full name of person in format configured for addressing.
"""
if
get_site_preferences
()[
"
notification__addressing_name_format
"
]
==
"
last_first
"
:
...
...
@@ -148,7 +148,7 @@ class Person(ExtensibleModel):
elif
get_site_preferences
()[
"
notification__addressing_name_format
"
]
==
"
first_last
"
:
return
f
"
{
self
.
first_name
}
{
self
.
last_name
}
"
@property
_
@property
def
age
(
self
):
"""
Age of the person at current time.
"""
return
self
.
age_at
(
timezone
.
datetime
.
now
().
date
())
...
...
@@ -289,7 +289,7 @@ class Group(ExtensibleModel):
def
get_absolute_url
(
self
)
->
str
:
return
reverse
(
"
group_by_id
"
,
args
=
[
self
.
id
])
@property
_
@property
def
announcement_recipients
(
self
):
"""
Flat list of all members and owners to fulfill announcement API contract.
"""
return
list
(
self
.
members
.
all
())
+
list
(
self
.
owners
.
all
())
...
...
@@ -459,7 +459,7 @@ class Announcement(ExtensibleModel):
verbose_name
=
_
(
"
Date and time until when to show
"
),
default
=
now_tomorrow
,
)
@property
_
@property
def
recipient_persons
(
self
)
->
Sequence
[
Person
]:
"""
Return a list of Persons this announcement is relevant for.
"""
persons
=
[]
...
...
@@ -490,7 +490,7 @@ class AnnouncementRecipient(ExtensibleModel):
Generalisation of a recipient for an announcement, used to wrap arbitrary
objects that can receive announcements.
Contract: Objects to serve as recipient have a property
_
announcement_recipients
Contract: Objects to serve as recipient have a property announcement_recipients
returning a flat list of Person objects.
"""
...
...
@@ -502,7 +502,7 @@ class AnnouncementRecipient(ExtensibleModel):
recipient_id
=
models
.
PositiveIntegerField
()
recipient
=
GenericForeignKey
(
"
content_type
"
,
"
recipient_id
"
)
@property
_
@property
def
persons
(
self
)
->
Sequence
[
Person
]:
"""
Return a list of Persons selected by this recipient object.
...
...
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