def view(self, *args, **kwargs):
        """Decorator to automatically apply as_view decorator and register it.
        """
        def decorator(f):
            kwargs.setdefault("view_class", self.view_class)
            return self.add_view(as_view(*args, **kwargs)(f))
        return decorator