Dimitris Kougioumtzis Blog About technology

Set Url kwargs to view

Category Django

Posted on July 17, 2017



Set Url kwargs to view


1
2
3
4
5
6
7
8
9
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)

About

My name is Dimitris Kougioumtzis and i work as a Web developer at Rapidbounce Company

Elsewhere