Skip to content

Commit

Permalink
Use datetime.date method to sub in proxy date for records with NULL v…
Browse files Browse the repository at this point in the history
…alue 'posted_date' (#274)

Co-authored-by: Garrett Edmonds <[email protected]>
  • Loading branch information
edmondsgarrett and Garrett Edmonds committed Feb 15, 2024
1 parent a2109be commit 7634f3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apcd-cms/src/apps/admin_regis_table/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from apps.utils.registrations_data_formatting import _set_registration
from apps.components.paginator.paginator import paginator
import logging
from dateutil import parser
from datetime import date as datetimeDate

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -95,7 +95,7 @@ def get_context_data(self, registrations_content, registrations_entities, regist

def getDate(row):
date = row[1]
return date if date is not None else parser.parse('1-1-0001') # put 'None' date entries all together at end of listing
return date if date is not None else datetimeDate(1,1,1) # put 'None' date entries all together at end of listing w/ date 1-1-0001

registrations_content = sorted(registrations_content, key=lambda row:getDate(row), reverse=True) # sort registrations by newest to oldest

Expand Down

0 comments on commit 7634f3c

Please sign in to comment.