mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
15 lines
422 B
Python
Executable File
15 lines
422 B
Python
Executable File
import logging
|
|
import datetime
|
|
import humanize
|
|
from tastypie.resources import ModelResource
|
|
|
|
|
|
class BackboneCompatibleResource(ModelResource):
|
|
logger = logging.getLogger(__name__)
|
|
pass
|
|
|
|
def humanize_date(self, date):
|
|
if (datetime.datetime.now() - date) <= datetime.timedelta(days=1):
|
|
return humanize.naturaltime(date)
|
|
else:
|
|
return humanize.naturalday(date) |