Set Url kwargs to view

Django -- Posted on July 17, 2017

Set Url kwargs to view

              
                class ProcessUrl(object):
    '''
    A mixin for class based views to set  kwargs from url pattern to view

    '''
   def dispatch(self, *args, **kwargs):
    for key, value in self.kwargs.items():
        setattr(self, key, value)
    return super(ProcessUrl, self).dispatch(*args, **kwargs)
                  
   
            

Related Posts