Skip to content
Snippets Groups Projects
Commit 26a4d506 authored by Julian's avatar Julian
Browse files

Filter date and subject of personal notes

parent 5559ac94
No related branches found
No related tags found
1 merge request!111Resolve "[Person overview] Implement multiple selection for marking absences as excused or for deleting"
from django.utils.translation import gettext as _
from django_filters import FilterSet, CharFilter, ModelMultipleChoiceFilter
from django_filters import FilterSet, CharFilter, ModelMultipleChoiceFilter, DateFilter
from material import Layout, Row
from .models import ExcuseType, PersonalNote
class PersonalNoteFilter(FilterSet):
day_start = DateFilter(lookup_expr="gte", label=_("After"))
day_end = DateFilter(lookup_expr="lte", label=_("Before"))
subject = CharFilter(lookup_expr="icontains", label=_("Subject"))
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.form.fields["late__lt"].label = _("Tardiness is lower than")
self.form.fields["late__gt"].label = _("Tardiness is bigger than")
self.form.layout = Layout(
# TODO: Row with day (lt and gt) and subject (char search),
Row("subject"),
Row("day_start", "day_end"),
Row("absent", "excused", "excuse_type"),
Row("late__lt", "late__gt", "extra_marks")
Row("late__gt", "late__lt", "extra_marks")
)
class Meta:
......@@ -23,6 +30,4 @@ class PersonalNoteFilter(FilterSet):
"absent": ['exact'],
"excuse_type": ["exact"],
"extra_marks": ["exact"],
# TODO: "date??": ['lt', 'gt'],
# TODO: "subject??": "exact",
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment