Python django_filters.rest_framework.FilterSet() Examples

The following are 2 code examples of django_filters.rest_framework.FilterSet(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django_filters.rest_framework , or try the search function .
Example #1
Source File: api.py    From karrot-backend with GNU Affero General Public License v3.0 5 votes vote down vote up
def message_conversation_queryset(request):
    """If the user asks to filter messages by conversation, trigger 'invalid_choice' in the FilterSet"""
    if request is None:
        return Conversation.objects.none()

    return Conversation.objects.with_access(request.user) 
Example #2
Source File: rest_api.py    From scirius with GNU General Public License v3.0 5 votes vote down vote up
def get_queryset(self):
        user = self.request.user
        Q = models.Q
        return FilterSet.objects.filter(Q(user=user) | Q(user=None))