def __call__(self, *args, **kw):
        if isinstance(args[0], Callable):
            self.add_view("/{}/".format(args[0].__name__), args[0])
            return args[0]

        def ddecorator(candidate):
            from django.forms import forms  # the following is unsafe
            if isinstance(candidate, forms.DeclarativeFieldsMetaclass):
                self.add_form(args[0], candidate, *args[1:], **kw)
                return candidate
            self.add_view(args[0], candidate, *args[1:], **kw)
            return candidate

        return ddecorator
Call the class instance.
dataset/ETHPy150Open amitu/importd/importd/__init__.py/Blueprint.__call__