def get_dashboard(context, location):
    dashboard_cls = get_current_dashboard(location, context['request'].user)

    resolver = resolve(context['request'].path)
    app_label = resolver.kwargs.get('app_label')

    return dashboard_cls(context, app_label=app_label)
예제 #2
0
def get_dashboard(context, location):
    dashboard_cls = get_current_dashboard(location)

    resolver = resolve(context['request'].path)
    app_label = resolver.kwargs.get('app_label')

    return dashboard_cls(context, app_label=app_label)
예제 #3
0
    def clean(self):
        data = super(AddUserDashboardModuleForm, self).clean()

        if 'app_label' in data:
            index_dashboard_cls = get_current_dashboard('app_index' if data['app_label'] else 'index')
            index_dashboard = index_dashboard_cls({'request': self.request}, app_label=data['app_label'])

            if 'type' in data:
                if data['type'] == 'children':
                    module = index_dashboard.children[data['module']]
                elif data['type'] == 'available_children':
                    module = index_dashboard.available_children[data['module']]()
                else:
                    raise ValidationError('error')

                self.module_cls = module
        return data
예제 #4
0
파일: forms.py 프로젝트: kelwys/Siscon
    def clean(self):
        data = super(AddUserDashboardModuleForm, self).clean()

        if 'app_label' in data:
            index_dashboard_cls = get_current_dashboard('app_index' if data['app_label'] else 'index')
            index_dashboard = index_dashboard_cls({'request': self.request}, app_label=data['app_label'])

            if 'type' in data:
                if data['type'] == 'children':
                    module = index_dashboard.children[data['module']]
                elif data['type'] == 'available_children':
                    module = index_dashboard.available_children[data['module']]()
                else:
                    raise ValidationError('error')

                self.module_cls = module
        return data
예제 #5
0
파일: forms.py 프로젝트: wass6/custom_jet
    def clean(self):
        data = super(AddUserDashboardModuleForm, self).clean()

        if (not user_is_authenticated(self.request.user)
                or not self.request.user.is_staff):
            raise ValidationError("error")

        if "app_label" in data:
            index_dashboard_cls = get_current_dashboard(
                "app_index" if data["app_label"] else "index")
            index_dashboard = index_dashboard_cls({"request": self.request},
                                                  app_label=data["app_label"])

            if "type" in data:
                if data["type"] == "children":
                    module = index_dashboard.children[data["module"]]
                elif data["type"] == "available_children":
                    module = index_dashboard.available_children[
                        data["module"]]()
                else:
                    raise ValidationError("error")

                self.module_cls = module
        return data
예제 #6
0
def get_dashboard(context, location):
    dashboard_cls = get_current_dashboard(location)

    app_label = context['request'].resolver_match.kwargs.get('app_label')

    return dashboard_cls(context, app_label=app_label)
예제 #7
0
def get_dashboard(context, location):
    dashboard_cls = get_current_dashboard(location)

    app_label = context['request'].resolver_match.kwargs.get('app_label')

    return dashboard_cls(context, app_label=app_label)
예제 #8
0
def get_dashboard(context, location):
    dashboard_cls = get_current_dashboard(location)
    dashboard = dashboard_cls(context)
    return dashboard