src/notes/api/filters.py
author ymh <ymh.work@gmail.com>
Mon, 08 Oct 2018 18:35:47 +0200
changeset 168 ea92f4fe783d
parent 128 34a75bd8d0b9
child 183 f8f3af9e5c83
permissions -rw-r--r--
- move SlateEditor and dependencies to its own folder - remove Immutable - remove redux-persist-immutable - remobe redux-immutable - update libraries - added tests on store manipulations (accessor and reducers)

'''
Inspired by https://stackoverflow.com/a/36289332
'''
from django_filters.rest_framework import (BaseInFilter, Filter, FilterSet,
                                           UUIDFilter)

from ..models import Note, Session

class ExtIdFilter(BaseInFilter, UUIDFilter):
    pass

class CoreFilterSet(FilterSet):
    ext_id__in = ExtIdFilter(name='ext_id')

class SessionFilterSet(CoreFilterSet):
    class Meta:
        model = Session
        fields = ['ext_id__in']

class NoteFilterSet(CoreFilterSet):
    class Meta:
        model = Note
        fields = ['ext_id__in']