Add our dashboard view to the admin urlconf. Deleted the default index.
493026
def get_urls(self):
        """"""
        from django.conf.urls import patterns, url
        from views import DashboardWelcomeView

        urls = super(AdminMixin, self).get_urls()
        del urls[0]
        custom_url = patterns(
            '',
            url(r'^$', self.admin_view(DashboardWelcomeView.as_view()), name="index")
        )

        return custom_url + urls
575353
def action_add_url(self):
        """"""
        if not self.env.context.get('active_model'):
            return
        attachment_obj = self.env['ir.attachment']
        for form in self:
            url = parse.urlparse(form.url)
            if not url.scheme:
                url = parse.urlparse('%s%s' % ('http://', form.url))
            for active_id in self.env.context.get('active_ids', []):
                attachment = {
                    'name': form.name,
                    'type': 'url',
                    'url': url.geturl(),
                    'res_id': active_id,
                    'res_model': self.env.context['active_model'],
                }
                attachment_obj.create(attachment)
        return {'type': 'ir.actions.act_close_wizard_and_reload_view'}
770949
def add_url(self):
        """"""
        if self.url:
            self.url_data.add_url(self.url, line=self.parser.CurrentLineNumber,
                column=self.parser.CurrentColumnNumber)
            self.url = u""
1226892
def add_view_no_menu(self, baseview, endpoint=None, static_folder=None):
        
        baseview = self._check_and_init(baseview)
        log.info(LOGMSG_INF_FAB_ADD_VIEW.format(baseview.__class__.__name__, ""))

        if not self._view_exists(baseview):
            baseview.appbuilder = self
            self.baseviews.append(baseview)
            self._process_inner_views()
            if self.app:
                self.register_blueprint(
                    baseview, endpoint=endpoint, static_folder=static_folder
                )
                self._add_permission(baseview)
        else:
            log.warning(LOGMSG_WAR_FAB_VIEW_EXISTS.format(baseview.__class__.__name__))
        return baseview
756714
def admin_index
      return unless user_is_allowed('post_categories', 'view')
      
      @main_cat = PostCategory.where("site_id = ?", @site.id).first      
      if @main_cat.nil?
        @main_cat = PostCategory.create(:site_id => @site.id, :name => 'General News')
      end
      render :layout => 'caboose/admin'
    end
1281347
def dashboard(request):
    ""
    end_time = now()
    start_time = end_time - timedelta(days=7)
    defaults = {'start': start_time, 'end': end_time}

    form = DashboardForm(data=request.GET or defaults)
    if form.is_valid():
        start_time = form.cleaned_data['start']
        end_time = form.cleaned_data['end']

    # determine when tracking began
    try:
        obj = Visitor.objects.order_by('start_time')[0]
        track_start_time = obj.start_time
    except (IndexError, Visitor.DoesNotExist):
        track_start_time = now()

    # If the start_date is before tracking began, warn about incomplete data
    warn_incomplete = (start_time < track_start_time)

    # queries take `date` objects (for now)
    user_stats = Visitor.objects.user_stats(start_time, end_time)
    visitor_stats = Visitor.objects.stats(start_time, end_time)
    if TRACK_PAGEVIEWS:
        pageview_stats = Pageview.objects.stats(start_time, end_time)
    else:
        pageview_stats = None

    context = {
        'form': form,
        'track_start_time': track_start_time,
        'warn_incomplete': warn_incomplete,
        'user_stats': user_stats,
        'visitor_stats': visitor_stats,
        'pageview_stats': pageview_stats,
    }
    return render(request, 'tracking/dashboard.html', context)
995340
public function indexAction()
    {
        if ($this->container->hasParameter('kunstmaan_admin.dashboard_route')) {
            return $this->redirect($this->generateUrl($this->getParameter('kunstmaan_admin.dashboard_route')));
        }

        /* @var DashboardConfiguration $dashboardConfiguration */
        $dashboardConfiguration = $this->getDoctrine()
            ->getManager()
            ->getRepository('KunstmaanAdminBundle:DashboardConfiguration')
            ->findOneBy(array());

        return array('dashboardConfiguration' => $dashboardConfiguration);
    }
122583
def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
        
        if self.url_prefix:
            rule = self.url_prefix + rule
        options.setdefault('subdomain', self.subdomain)
        if endpoint is None:
            endpoint = _endpoint_from_view_func(view_func)
        defaults = self.url_defaults
        if 'defaults' in options:
            defaults = dict(defaults, **options.pop('defaults'))
        self.app.add_url_rule(rule, endpoint, view_func, defaults=defaults, **options)
400527
def dashboard(self, dashboard_id):
        """"""
        session = db.session()
        qry = session.query(models.Dashboard)
        if dashboard_id.isdigit():
            qry = qry.filter_by(id=int(dashboard_id))
        else:
            qry = qry.filter_by(slug=dashboard_id)

        dash = qry.one_or_none()
        if not dash:
            abort(404)
        datasources = set()
        for slc in dash.slices:
            datasource = slc.datasource
            if datasource:
                datasources.add(datasource)

        if config.get('ENABLE_ACCESS_REQUEST'):
            for datasource in datasources:
                if datasource and not security_manager.datasource_access(datasource):
                    flash(
                        __(security_manager.get_datasource_access_error_msg(datasource)),
                        'danger')
                    return redirect(
                        'superset/request_access/?'
                        f'dashboard_id={dash.id}&')

        dash_edit_perm = check_ownership(dash, raise_if_false=False) and \
            security_manager.can_access('can_save_dash', 'Superset')
        dash_save_perm = security_manager.can_access('can_save_dash', 'Superset')
        superset_can_explore = security_manager.can_access('can_explore', 'Superset')
        superset_can_csv = security_manager.can_access('can_csv', 'Superset')
        slice_can_edit = security_manager.can_access('can_edit', 'SliceModelView')

        standalone_mode = request.args.get('standalone') == 'true'
        edit_mode = request.args.get('edit') == 'true'

        # Hack to log the dashboard_id properly, even when getting a slug
        @log_this
        def dashboard(**kwargs):  # noqa
            pass
        dashboard(
            dashboard_id=dash.id,
            dashboard_version='v2',
            dash_edit_perm=dash_edit_perm,
            edit_mode=edit_mode)

        dashboard_data = dash.data
        dashboard_data.update({
            'standalone_mode': standalone_mode,
            'dash_save_perm': dash_save_perm,
            'dash_edit_perm': dash_edit_perm,
            'superset_can_explore': superset_can_explore,
            'superset_can_csv': superset_can_csv,
            'slice_can_edit': slice_can_edit,
        })

        bootstrap_data = {
            'user_id': g.user.get_id(),
            'dashboard_data': dashboard_data,
            'datasources': {ds.uid: ds.data for ds in datasources},
            'common': self.common_bootsrap_payload(),
            'editMode': edit_mode,
        }

        if request.args.get('json') == 'true':
            return json_success(json.dumps(bootstrap_data))

        return self.render_template(
            'superset/dashboard.html',
            entry='dashboard',
            standalone_mode=standalone_mode,
            title=dash.dashboard_title,
            bootstrap_data=json.dumps(bootstrap_data),
        )
999164
def add_url(self, post_data):
        '''
        
        '''
        img_desc = post_data['desc']
        img_path = post_data['file1']
        cur_uid = tools.get_uudd(4)
        while MEntity.get_by_uid(cur_uid):
            cur_uid = tools.get_uudd(4)
        MEntity.create_entity(cur_uid, img_path, img_desc, kind=post_data['kind'] if 'kind' in post_data else '3')
        kwd = {
            'kind': post_data['kind'] if 'kind' in post_data else '3',

        }
        self.render('misc/entity/entity_view.html',
                    filename=img_path,
                    cfg=config.CMS_CFG,
                    kwd=kwd,
                    userinfo=self.userinfo)
1132492
public function add()
    {
        $dashboard = $this->Dashboards->newEntity();

        /**
         * @var \Search\Model\Table\WidgetsTable $widgetsTable
         */
        $widgetsTable = TableRegistry::get('Search.Widgets');
        $widgets = $widgetsTable->getWidgets();

        if ($this->request->is('post')) {
            $data = (array)$this->request->getData();

            $widgets = [];

            $dashboard = $this->Dashboards->patchEntity($dashboard, [
                'name' => $data['name'],
                'role_id' => $data['role_id'],
            ]);

            $resultedDashboard = $this->Dashboards->save($dashboard);

            if ($resultedDashboard) {
                $this->Flash->success((string)__('The dashboard has been saved.'));

                $dashboardId = $resultedDashboard->id;

                $data['widgets'] = !empty($data['options']) ? json_decode($data['options'], true) : [];

                if (!empty($data['widgets'])) {
                    $widgetsTable->saveDashboardWidgets($dashboardId, $data['widgets']);
                }

                return $this->redirect(['action' => 'view', $dashboard->id]);
            } else {
                $this->Flash->error((string)__('The dashboard could not be saved. Please, try again.'));
            }
        }

        $roles = $this->Dashboards->Roles->find('list', ['limit' => 200]);
        $savedWidgetData = [];

        $this->set(compact('dashboard', 'roles', 'widgets', 'savedWidgetData'));
        $this->set('columns', Configure::readOrFail('Search.dashboard.columns'));
        $this->set('_serialize', ['dashboard']);
    }
1352708
public function dashboard()
    {
        //if the dev has chosen to use a dashboard
        if (config('administrator.use_dashboard')) {
            //set the layout dashboard
            $this->layout->dashboard = true;

            //set the layout content
            $this->layout->content = view(config('administrator.dashboard_view'));

            return $this->layout;
        }
        //else we should redirect to the menu item
        else {
            $configFactory = app('admin_config_factory');
            $home          = config('administrator.home_page');

            //first try to find it if it's a model config item
            $config = $configFactory->make($home);

            if (!$config) {
                throw new \InvalidArgumentException('Administrator: '.trans('administrator::administrator.valid_home_page'));
            } elseif ($config->getType() === 'model') {
                return redirect()->route('admin_index', array($config->getOption('name')));
            } elseif ($config->getType() === 'settings') {
                return redirect()->route('admin_settings', array($config->getOption('name')));
            }
        }
    }
791597
public function dashboard()
    {
        $users = \App\User::all()->count();
        $roles = \Spatie\Permission\Models\Role::all()->count();
        $permissions = \Spatie\Permission\Models\Permission::all()->count();
        $entities = \Amranidev\ScaffoldInterface\Models\Scaffoldinterface::all();

        return view('scaffold-interface.dashboard.dashboard', compact('users', 'roles', 'permissions', 'entities'));
    }
1239378
def get_admin_urls_for_registration(self):
        
        urls = (
            url(get_url_pattern(self.opts),
                self.index_view, name=get_url_name(self.opts)),
            url(get_url_pattern(self.opts, 'create'),
                self.create_view, name=get_url_name(self.opts, 'create')),
            url(get_object_specific_url_pattern(self.opts, 'edit'),
                self.edit_view, name=get_url_name(self.opts, 'edit')),
            url(get_object_specific_url_pattern(self.opts, 'confirm_delete'),
                self.confirm_delete_view,
                name=get_url_name(self.opts, 'confirm_delete')),
        )
        if self.inspect_view_enabled:
            urls = urls + (
                url(get_object_specific_url_pattern(self.opts, 'inspect'),
                    self.inspect_view,
                    name=get_url_name(self.opts, 'inspect')),
            )
        if self.is_pagemodel:
            urls = urls + (
                url(get_url_pattern(self.opts, 'choose_parent'),
                    self.choose_parent_view,
                    name=get_url_name(self.opts, 'choose_parent')),
                url(get_object_specific_url_pattern(self.opts, 'unpublish'),
                    self.unpublish_view,
                    name=get_url_name(self.opts, 'unpublish')),
                url(get_object_specific_url_pattern(self.opts, 'copy'),
                    self.copy_view,
                    name=get_url_name(self.opts, 'copy')),
            )
        return urls

        def construct_main_menu(self, request, menu_items):
            warnings.warn((
                "The 'construct_main_menu' method is now deprecated. You "
                "should also remove the construct_main_menu hook from "
                "wagtail_hooks.py in your app folder."), DeprecationWarning)
            return menu_items
241301
public function indexAction()
    {

        header("HTTP/1.0 404 Not Found");

        $data['title'] = '404';
        $data['error'] = $this->_error;

        $this->view->render('error/404', $data);
    }
618243
def admin_view_url(admin_site: AdminSite,
                   obj,
                   view_type: str = "change",
                   current_app: str = None) -> str:
    
    app_name = obj._meta.app_label.lower()
    model_name = obj._meta.object_name.lower()
    pk = obj.pk
    viewname = "admin:{}_{}_{}".format(app_name, model_name, view_type)
    if current_app is None:
        current_app = admin_site.name
    url = reverse(viewname, args=[pk], current_app=current_app)
    return url
1249154
def _view_or_add(self, uid):
        '''
        
        '''
        postinfo = MPost.get_by_uid(uid)
        if postinfo:
            self.viewinfo(postinfo)
        elif self.userinfo:
            self._to_add(uid=uid)
        else:
            self.show404()