Files
dss/spa/api/v1/BackboneCompatibleResource.py
2014-01-08 22:32:26 +00:00

15 lines
413 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 (timezone.now() - date) <= datetime.timedelta(days=1):
return humanize.naturaltime(date)
else:
return humanize.naturalday(date)