Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
aa69f7e0
Unverified
Commit
aa69f7e0
authored
Mar 21, 2018
by
Thom Wiggers
📐
Browse files
Order cancellations by cancellation date
Closes
#616
parent
ba1aa79f
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/events/models.py
View file @
aa69f7e0
...
...
@@ -151,29 +151,36 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
return
self
.
registrationinformationfield_set
.
count
()
>
0
def
reached_participants_limit
(
self
):
"""Is this event up to capacity?"""
return
(
self
.
max_participants
is
not
None
and
self
.
max_participants
<=
self
.
registration_set
.
filter
(
date_cancelled
=
None
).
count
())
@
property
def
registrations
(
self
):
"""Queryset with all non-cancelled registrations"""
return
self
.
registration_set
.
filter
(
date_cancelled
=
None
)
@
property
def
participants
(
self
):
"""Return the active participants"""
if
self
.
max_participants
is
not
None
:
return
self
.
registrations
.
order_by
(
'date'
)[:
self
.
max_participants
]
return
self
.
registrations
.
order_by
(
'date'
)
@
property
def
queue
(
self
):
"""Return the waiting queue"""
if
self
.
max_participants
is
not
None
:
return
self
.
registrations
.
order_by
(
'date'
)[
self
.
max_participants
:]
return
[]
@
property
def
cancellations
(
self
):
return
self
.
registration_set
.
exclude
(
date_cancelled
=
None
)
"""Return a queryset with the cancelled events"""
return
(
self
.
registration_set
.
exclude
(
date_cancelled
=
None
)
.
order_by
(
'date_cancelled'
))
@
property
def
registration_allowed
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment