Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions backend/contributions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,13 @@ def text_preview(self, obj):

def get_status(self, obj):
from django.utils import timezone as tz
from django.utils.safestring import mark_safe
now = tz.now()
if not obj.is_active:
return format_html('<span style="color: gray;">●</span> Inactive')
return mark_safe('<span style="color: gray;">●</span> Inactive')
if obj.start_date and now < obj.start_date:
return format_html('<span style="color: orange;">●</span> Scheduled')
return mark_safe('<span style="color: orange;">●</span> Scheduled')
if obj.end_date and now > obj.end_date:
return format_html('<span style="color: red;">●</span> Expired')
return format_html('<span style="color: green;">●</span> Active')
return mark_safe('<span style="color: red;">●</span> Expired')
return mark_safe('<span style="color: green;">●</span> Active')
get_status.short_description = 'Status'
Loading