dates.py 531 B

1234567891011121314151617
  1. from datetime import timedelta
  2. from django.conf import settings
  3. from django.utils import timezone
  4. def is_date_tracked(date, user, category_read_cutoff=None):
  5. if date:
  6. cutoff_date = timezone.now() - timedelta(days=settings.MISAGO_READTRACKER_CUTOFF)
  7. if cutoff_date < user.joined_on:
  8. cutoff_date = user.joined_on
  9. if category_read_cutoff and cutoff_date < category_read_cutoff:
  10. cutoff_date = category_read_cutoff
  11. return date > cutoff_date
  12. else:
  13. return False