Example #1
0
def scan(module, predicate=None):
    view_classes = utils.find_views(module, predicate=predicate)
    urls = []
    for view in view_classes:
        if hasattr(view, 'as_urls'):
            urls.extend(view.as_urls())
        else:
            urls.append(view.as_url())
    pattern = urls
    return pattern
Example #2
0
def scan(module, predicate=None):
    view_classes = utils.find_views(module, predicate=predicate)
    urls = []
    for view in view_classes:
        if hasattr(view, 'as_urls'):
            urls.extend(view.as_urls())
        else:
            urls.append(view.as_url())
    pattern = urls
    return pattern
Example #3
0
    def handle(self, **options):
        view = options["view"]
        try:
            view_class = importlib.import_module(view)
        except ImportError:
            view_class = import_string(view)

        if inspect.ismodule(view_class):
            view_classes = utils.find_views(view_class)
        else:
            view_classes = [view_class]

        for view in view_classes:
            app = views.ViewPatch(view)
            app.patch()