Skip to content

Filters

hypha.apply.activity.filters

NotificationFilter

Bases: FilterSet

timestamp_choices class-attribute instance-attribute

timestamp_choices = [('today', gettext_lazy('Today')), ('yesterday', gettext_lazy('Yesterday')), ('week', gettext_lazy('Past 7 days')), ('month', gettext_lazy('This month'))]

timestamp_filters class-attribute instance-attribute

timestamp_filters = {'today': lambda qs, name: filter(**{'%s__year' % name: year, '%s__month' % name: month, '%s__day' % name: day}), 'yesterday': lambda qs, name: filter(**{'%s__year' % name: year, '%s__month' % name: month, '%s__day' % name: day}), 'week': lambda qs, name: filter(**{'%s__gte' % name: _truncate(now() - timedelta(days=7)), '%s__lt' % name: _truncate(now() + timedelta(days=1))}), 'month': lambda qs, name: filter(**{'%s__year' % name: year, '%s__month' % name: month})}

date class-attribute instance-attribute

date = DateRangeFilter(field_name='timestamp', choices=timestamp_choices, filters=timestamp_filters)

Meta

model class-attribute instance-attribute
model = Activity
fields class-attribute instance-attribute
fields = {}