cutoffdate.py 344 B

12345678910111213
  1. from datetime import timedelta
  2. from django.utils import timezone
  3. from ..conf import settings
  4. def get_cutoff_date(settings, user=None):
  5. cutoff_date = timezone.now() - timedelta(days=settings.readtracker_cutoff)
  6. if user and user.is_authenticated and user.joined_on > cutoff_date:
  7. return user.joined_on
  8. return cutoff_date