home.filters

Contains custom filter sets to filter model data based on various criteria.

Module Contents

class home.filters.NotificationFilter(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: django_filters.FilterSet

Filters notifications based on various criteria such as date range and status.

notification_type[source]
notification_source[source]
date_range[source]
class Meta[source]

Configures the filter set’s model and fields for filtering.

model[source]
fields: ClassVar[list[str]] = ['notification_type', 'notification_source'][source]
static filter_by_multiple_types(queryset, _, value)[source]

Split the comma-separated values into a list for types.

Parameters:
  • queryset (django.db.models.QuerySet[management.models.NotificationModel]) – The queryset of NotificationModel.

  • _ (str) – A placeholder parameter for type.

  • value (str) – The value to filter the queryset by.

Returns:

The filtered queryset based on the provided value.

Return type:

django.db.models.QuerySet[management.models.NotificationModel]

static filter_by_multiple_sources(queryset, _, value)[source]

Split the comma-separated values into a list for sources.

Parameters:
  • queryset (django.db.models.QuerySet[management.models.NotificationModel]) – The queryset of NotificationModel.

  • _ (str) – A placeholder parameter for type.

  • value (str) – The value to filter the queryset by.

Returns:

The filtered queryset based on the provided value.

Return type:

django.db.models.QuerySet[management.models.NotificationModel]

static filter_by_date_range(queryset, _, value)[source]

Filter the given QuerySet by date range.

Parameters:
  • queryset (django.db.models.QuerySet[management.models.NotificationModel]) – The queryset of NotificationModel.

  • _ (str) – A placeholder parameter for type.

  • value (str) – The value to filter the queryset by.

Returns:

The filtered queryset based on the provided value.

Return type:

django.db.models.QuerySet[management.models.NotificationModel]