inputlogic / django-api-starter

Boilerplate for starting Django DRF / API projects
2 stars 0 forks source link

Customer filter class to filter by multiple ids #5

Open staydecent opened 6 years ago

staydecent commented 6 years ago

Instead of adding if statements to get_queryset

        parents = self.request.query_params.get('parents', None)
        if parents:
            parents = [int(x) for x in parents.split(',')]
            queryset = queryset.filter(parent__pk__in=parents)