class QuerystringRedirect(RedirectView):
    """
    Used to redirect to remove GET parameters from url
    e.g. /permalink/?id=10 to /permalink/10/   
    """

def get_redirect_url(self):
    if 'id' in self.request.GET:
        pass
How to redirect url pattern with variables from urls.py in Django?