-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored option & status_options to info & applicant_info
- Loading branch information
1 parent
64d9036
commit 70414fb
Showing
5 changed files
with
27 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
physionet-django/events/templatetags/participation_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
from django import template | ||
|
||
from events.models import EventApplication | ||
from project.authorization.events import has_access_to_event_dataset as has_access_to_event_dataset_func | ||
from project.authorization.events import ( | ||
has_access_to_event_dataset as has_access_to_event_dataset_func, | ||
) | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter(name='is_participant') | ||
@register.filter(name="is_participant") | ||
def is_participant(user, event): | ||
return event.participants.filter(user=user).exists() | ||
|
||
|
||
@register.filter(name='is_on_waiting_list') | ||
@register.filter(name="is_on_waiting_list") | ||
def is_on_waiting_list(user, event): | ||
return EventApplication.objects.filter( | ||
user=user, | ||
event=event, | ||
status=EventApplication.EventApplicationStatus.WAITLISTED | ||
status=EventApplication.EventApplicationStatus.WAITLISTED, | ||
).exists() | ||
|
||
|
||
@register.filter(name='has_access_to_event_dataset') | ||
@register.filter(name="has_access_to_event_dataset") | ||
def has_access_to_event_dataset(user, dataset): | ||
return has_access_to_event_dataset_func(user, dataset) | ||
|
||
|
||
@register.filter(name='get_status_options') | ||
def get_status_options(event_details, event_id): | ||
@register.filter(name="get_applicant_info") | ||
def get_applicant_info(event_details, event_id): | ||
return event_details[event_id] |