from django.db import IntegrityError
from django.http import Http404


class MultipleIDMixin(object):
    """
    Override get_queryset for multiple id support
    """
    def get_queryset(self):
        """
        Override :meth:``get_queryset``
        """
        if hasattr(self.request, 'query_params') and 'ids' in self.request.query_params:
            query_param_ids = self.request.query_params.get('ids')
            ids = [] if not query_param_ids else query_param_ids.split(',')

            try:
                self.queryset = self.queryset.filter(pk__in=ids)
            except (ValueError, IntegrityError):
                raise Http404
        return self.queryset

from django.db import IntegrityError
from django.http import Http404


class MultipleIDMixin(object):
    """
    Override get_queryset for multiple id support
    """
    def get_queryset(self):
        """
        Override :meth:``get_queryset``
        """
        if hasattr(self.request, 'query_params') and 'filter[id]' in self.request.query_params:
            query_param_ids = self.request.query_params.get('filter[id]')
            ids = [] if not query_param_ids else query_param_ids.split(',')

            try:
                self.queryset = self.queryset.filter(pk__in=ids)
            except (ValueError, IntegrityError):
                raise Http404
        return self.queryset

Update query param for mixin
Update query param for mixin

  from django.db import IntegrityError
  from django.http import Http404
  
  
  class MultipleIDMixin(object):
      """
      Override get_queryset for multiple id support
      """
      def get_queryset(self):
          """
          Override :meth:``get_queryset``
          """
-         if hasattr(self.request, 'query_params') and 'ids' in self.request.query_params:
+         if hasattr(self.request, 'query_params') and 'filter[id]' in self.request.query_params:
-             query_param_ids = self.request.query_params.get('ids')
+             query_param_ids = self.request.query_params.get('filter[id]')
              ids = [] if not query_param_ids else query_param_ids.split(',')
  
              try:
                  self.queryset = self.queryset.filter(pk__in=ids)
              except (ValueError, IntegrityError):
                  raise Http404
          return self.queryset
  
Update query param for mixin
## Code Before:
from django.db import IntegrityError
from django.http import Http404


class MultipleIDMixin(object):
    """
    Override get_queryset for multiple id support
    """
    def get_queryset(self):
        """
        Override :meth:``get_queryset``
        """
        if hasattr(self.request, 'query_params') and 'ids' in self.request.query_params:
            query_param_ids = self.request.query_params.get('ids')
            ids = [] if not query_param_ids else query_param_ids.split(',')

            try:
                self.queryset = self.queryset.filter(pk__in=ids)
            except (ValueError, IntegrityError):
                raise Http404
        return self.queryset

## Instruction:
Update query param for mixin
## Code After:
from django.db import IntegrityError
from django.http import Http404


class MultipleIDMixin(object):
    """
    Override get_queryset for multiple id support
    """
    def get_queryset(self):
        """
        Override :meth:``get_queryset``
        """
        if hasattr(self.request, 'query_params') and 'filter[id]' in self.request.query_params:
            query_param_ids = self.request.query_params.get('filter[id]')
            ids = [] if not query_param_ids else query_param_ids.split(',')

            try:
                self.queryset = self.queryset.filter(pk__in=ids)
            except (ValueError, IntegrityError):
                raise Http404
        return self.queryset
