コード例 #1
0
class SessaoFilter(django_filters.FilterSet):
    sessao_gte = TimeFilter(field_name="hora_de_inicio", lookup_expr='gte')
    sessao_lte = TimeFilter(field_name="hora_de_inicio", lookup_expr='lte')

    class Meta:
        model = Sessao
        fields = '__all__'
コード例 #2
0
class MeetingFilterSet(FilterSet):
    start_gte = TimeFilter(field_name='start', lookup_expr='gte')
    end_lte = TimeFilter(field_name='end', lookup_expr='lte')

    class Meta:
        model = Meeting
        fields = [
            'room',
            'status',
            'date',
            'start',
            'end',
            'start_gte',
            'end_lte',
        ]
コード例 #3
0
class AllFiltersFilterSet(FilterSet):
    number_AllValuesFilter = AllValuesFilter(field_name='number', lookup_expr='exact')
    number_AllValuesMultipleFilter_OR = AllValuesMultipleFilter(field_name='number', lookup_expr='exact', conjoined=False)  # OR
    number_AllValuesMultipleFilter_AND = AllValuesMultipleFilter(field_name='number', lookup_expr='exact', conjoined=True)  # AND
    number_BaseCSVFilterNumber = BaseCSVFilterNumber(field_name='number', lookup_expr='in')
    number_BaseInFilterNumber = BaseInFilterNumber(field_name='number', lookup_expr='in')
    number_BaseRangeFilterNumber = BaseRangeFilterNumber(field_name='number', lookup_expr='range')
    is_true_BooleanFilter = BooleanFilter(field_name='is_true', lookup_expr='exact')
    text_CharFilter = CharFilter(field_name='text', lookup_expr='exact')
    number_ChoiceFilter = ChoiceFilter(field_name='number', lookup_expr='exact', choices=NUMBER_CHOICES)
    date_DateFilter = DateFilter(field_name='date', lookup_expr='exact')
    date_DateFromToRangeFilter = DateFromToRangeFilter(field_name='date', lookup_expr='range')
    date_DateRangeFilter = DateRangeFilter(field_name='date', lookup_expr='exact')
    date_time_DateTimeFilter = DateTimeFilter(field_name='date_time', lookup_expr='exact')
    date_time_DateTimeFromToRangeFilter = DateTimeFromToRangeFilter(field_name='date_time', lookup_expr='range')
    duration_DurationFilter = DurationFilter(field_name='duration', lookup_expr='exact')
    iso_date_time_IsoDateTimeFilter = IsoDateTimeFilter(field_name='iso_date_time', lookup_expr='lt')
    iso_date_time_IsoDateTimeFromToRangeFilter = IsoDateTimeFromToRangeFilter(field_name='iso_date_time', lookup_expr='range')
    number_MultipleChoiceFilter_OR = MultipleChoiceFilter(field_name='number', lookup_expr='exact', conjoined=False, choices=NUMBER_CHOICES)
    number_MultipleChoiceFilter_AND = MultipleChoiceFilter(field_name='number', lookup_expr='exact', conjoined=True, choices=NUMBER_CHOICES)
    number_NumberFilter = NumberFilter(field_name='number', lookup_expr='exact')
    number_OrderingFilter = OrderingFilter(fields=('number', 'number'))
    number_RangeFilter = RangeFilter(field_name='number', lookup_expr='range')
    time_TimeFilter = TimeFilter(field_name='time', lookup_expr='exact')
    time_TimeRangeFilter = TimeRangeFilter(field_name='time', lookup_expr='range')
    number_TypedChoiceFilter = TypedChoiceFilter(field_name='number', lookup_expr='exact', choices=NUMBER_CHOICES)
    text_TypedMultipleChoiceFilter_OR = TypedMultipleChoiceFilter(field_name='number', lookup_expr='exact', conjoined=False, choices=NUMBER_CHOICES)
    text_TypedMultipleChoiceFilter_AND = TypedMultipleChoiceFilter(field_name='number', lookup_expr='exact', conjoined=True, choices=NUMBER_CHOICES)
    uuid_UUIDFilter = UUIDFilter(field_name='uuid', lookup_expr='exact')
    number_LookupChoiceFilter = LookupChoiceFilter(field_name='number')

    class Meta:
        model = BenchmarkModel
        exclude = ['number', 'text', 'is_true', 'date', 'date_time', 'duration']
コード例 #4
0
    class PropertyTimeFilterSet(PropertyFilterSet):
        time = TimeFilter(field_name='time', lookup_expr=lookup_xpr)
        prop_time = PropertyTimeFilter(field_name='prop_time',
                                       lookup_expr=lookup_xpr)

        class Meta:
            model = TimeFilterModel
            fields = ['prop_time']
コード例 #5
0
class AtividadeFilter(django_filters.FilterSet):
    nome = CharFilter(field_name='nome', lookup_expr='icontains')
    tipo_atividade = CharFilter(field_name='tipo_atividade')
    validada = NumberFilter(field_name='validada')
    localcampus = CharFilter(field_name='localid__campusid')
    localedicifio = CharFilter(field_name='localid__edicifioid')
    data = DateFilter(field_name="sessaoatividade__data", distinct=True)
    sessao_gte = TimeFilter(
        field_name="sessaoatividade__sessaoid__hora_de_inicio",
        lookup_expr='gte',
        distinct=True)
    sessao_lte = TimeFilter(
        field_name="sessaoatividade__sessaoid__hora_de_inicio",
        lookup_expr='lte',
        distinct=True)

    class Meta:
        model = Atividade
        fields = '__all__'
コード例 #6
0
    class TimeFilterSet(FilterSet):
        time = TimeFilter(field_name='time', lookup_expr=lookup_xpr)

        class Meta:
            model = TimeFilterModel
            fields = ['time']
コード例 #7
0
 (
     DateTimeFilter(input_formats=['%Y-%m-%dT%H %M %S %z']),
     {
         'type': 'string',
         'format': 'date-time',
         'example': '2022-01-31T11 22 33 +0000'
     },
 ),
 (DateTimeFromToRangeFilter(), {
     'type': 'string',
     'format': 'date-time'
 }),
 (NumberFilter(), {
     'type': 'number'
 }),
 (TimeFilter(), {
     'type': 'string',
     'format': 'time',
     'example': '11:22:33'
 }),
 (TimeFilter(input_formats=['%H %M %S %f']), {
     'type': 'string',
     'format': 'time',
     'example': '11 22 33 000000'
 }),
 (ModelChoiceFilter(), {
     'type': 'string'
 }),
 (ModelMultipleChoiceFilter(), {
     'type': 'string'
 }),