Django view method. We provide a default detail view for
        applications.
351784
def get_next_action(self, request, application, label, roles):
        

        # We only provide a view for when no label provided
        if label is not None:
            return HttpResponseBadRequest("<h1>Bad Request</h1>")

        # only certain actions make sense for default view
        actions = self.get_actions(request, application, roles)

        # process the request in default view
        if request.method == "GET":
            context = self.context
            context.update({
                'application': application,
                'actions': actions,
                'state': self.name,
                'roles': roles})
            return render(
                template_name='kgapplications/common_detail.html',
                context=context,
                request=request)
        elif request.method == "POST":
            for action in actions:
                if action in request.POST:
                    return action

        # we don't know how to handle this request.
        return HttpResponseBadRequest("<h1>Bad Request</h1>")
611068
def _list_view(self, model, **kwargs):
        
        from uliweb import request

        #add download fields process
        fields = kwargs.pop('fields', None)
        meta = kwargs.pop('meta', 'Table')
        if 'download' in request.GET:
            if 'download_fields' in kwargs:
                fields = kwargs.pop('download_fields', fields)
            if 'download_meta' in kwargs:
                meta = kwargs.pop('download_meta')
            else:
                if hasattr(model, 'Download'):
                    meta = 'Download'
                else:
                    meta = meta

        view = functions.ListView(model, fields=fields, meta=meta, **kwargs)
        return view
66950
def generate_detail_view(self):
        """"""

        name = model_class_form(self.model + 'DetailView')
        detail_args = dict(
            detailview_excludes=self.detailview_excludes,
            model=self.get_model_class,
            template_name=self.get_template('detail'),
            login_required=self.check_login_required,
            permissions=self.view_permission('detail'),
            inlineformset=self.inlineformset,
            permission_required=self.check_permission_required,
            custom_postfix_url=self.custom_postfix_url
        )

        detail_class = type(name, (BaseDetailViewMixin, DetailView), detail_args)
        self.classes[name] = detail_class
        return detail_class
505434
function initViews () {
    // list of views - may be empty
    this.modelViews = []
    // if view is false no model views will be applied overriding any defaults
    if (this.args.view === false) {
        return
    }
    // get view from args or default
    var viewArg = defined(this.args.view) ? this.args.view : this.model.views.default
    // skip unless view arg is set from args or default
    if (!defined(viewArg)) {
        return
    }
    // list of views to apply to model
    var views
    // if view is string then convert to array
    if (typeof viewArg === 'string') {
        views = [viewArg]
    }
    // if view is array use it
    else if (Array.isArray(viewArg)) {
        views = viewArg
    }
    // invalid argument
    else {
        throw this.error('invalid view argument')
    }
    // iterate over views getting model view objects
    _.each(views, view => {
        var modelView = requireValidModelView(view, this.model.views, true)
        // if result is array then add all
        if (Array.isArray(modelView)) {
            _.each(modelView, modelView => this.modelViews.push(modelView))
        }
        // otherwise add object
        else {
            this.modelViews.push(modelView)
        }
    })
    // instantiate model view engine if there are views
    if (this.modelViews.length > 0) {
        this.modelViewEngine = new ImmutableCoreModelViewEngine({query: this})
    }
}
1095638
def get_object_detail(self, request, obj):
        
        if self.display_detail_fields:
            display_fields = self.display_detail_fields
        else:
            display_fields = self.display_fields

        data = self.serialize(obj, ['id'] + list(display_fields))
        return HttpResponse(self.json_dumps(data), content_type='application/json')
1155557
def as_view(cls, *class_args, **class_kwargs):
        

        def view(*args, **kwargs):
            self = view.view_class(*class_args, **class_kwargs)
            return self.dispatch_request(*args, **kwargs)

        if cls.decorators:
            view.__module__ = cls.__module__
            for decorator in cls.decorators:
                view = decorator(view)

        view.view_class = cls
        view.__doc__ = cls.__doc__
        view.__module__ = cls.__module__
        view.__name__ = cls.__name__
        return view
1191415
def get_views(self, app_id, include_standard_views=False):
        
        include_standard = "true" if include_standard_views is True else "false"
        return self.transport.GET(url='/view/app/{}/?include_standard_views={}'.format(app_id, include_standard))
663584
def process_views(self):
        """"""
        output = {}
        logger.debug("Processing %d view(s)...", len(self.views))
        for view_name, view in iteritems(self.views):
            try:
                output = deep_merge_dict(
                    output,
                    view.process(
                        self.db,
                        safe_mode=self.safe_mode,
                        extra_context=self.project_context
                    )
                )
            except StatikError as exc:
                # just re-raise it
                raise exc

            except Exception as exc:
                # for unhandled view-related exceptions, raise our own exception
                raise ViewError(
                    message="Failed to render view \"%s\"." % view_name,
                    orig_exc=exc
                )

        return output
46842
def mainview(request, **criterias):
	''
	view_data = initview(request)
	wrap = lambda func: ft.partial(func, _view_data=view_data, **criterias)
	return condition(
			etag_func=wrap(cache_etag),
			last_modified_func=wrap(cache_last_modified) )\
		(_mainview)(request, view_data, **criterias)
953049
def add_view(self, request, form_url='', extra_context=None):
        """"""
        model = self.model
        opts = model._meta

        if not self.has_add_permission(request):
            raise PermissionDenied

        ModelForm = self.get_form(request)
        formsets = []

        if request.method == 'POST':
            form = ModelForm(request.POST, request.FILES)

            if form.is_valid():
                new_object = self.save_form(request, form, change=False)
                form_validated = True
            else:
                form_validated = False
                new_object = self.model()

            prefixes = {}

            for FormSet, inline in zip(self.get_formsets(request),
                                       self.get_inline_instances(request)):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1

                if prefixes[prefix] != 1:
                    prefix = "{0}-{1}".format(prefix, prefixes[prefix])

                formset = FormSet(data=request.POST, files=request.FILES,
                                  instance=new_object,
                                  save_as_new="_saveasnew" in request.POST,
                                  prefix=prefix, queryset=inline.queryset(request))

                formsets.append(formset)

                for inline in self.get_inline_instances(request):
                    # If this is the inline that matches this formset, and
                    # we have some nested inlines to deal with, then we need
                    # to get the relevant formset for each of the forms in
                    # the current formset.
                    if inline.inlines and inline.model == formset.model:
                        for nested in inline.inline_instances:
                            for the_form in formset.forms:
                                InlineFormSet = nested.get_formset(request, the_form.instance)
                                prefix = "{0}-{1}".format(the_form.prefix,
                                                          InlineFormSet.get_default_prefix())
                                formsets.append(InlineFormSet(request.POST, request.FILES,
                                                              instance=the_form.instance,
                                                              prefix=prefix))
            if all_valid(formsets) and form_validated:
                self.save_model(request, new_object, form, change=False)
                form.save_m2m()

                for formset in formsets:
                    self.save_formset(request, form, formset, change=False)

                self.log_addition(request, new_object)

                return self.response_add(request, new_object)
        else:
            # Prepare the dict of initial data from the request.
            # We have to special-case M2Ms as a list of comma-separated PKs.
            initial = dict(request.GET.items())

            for k in initial:
                try:
                    f = opts.get_field(k)
                except models.FieldDoesNotExist:
                    continue

                if isinstance(f, models.ManyToManyField):
                    initial[k] = initial[k].split(",")

            form = ModelForm(initial=initial)
            prefixes = {}

            for FormSet, inline in zip(self.get_formsets(request),
                                       self.get_inline_instances(request)):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1

                if prefixes[prefix] != 1:
                    prefix = "{0}-{1}".format(prefix, prefixes[prefix])

                formset = FormSet(instance=self.model(), prefix=prefix,
                                  queryset=inline.queryset(request))
                formsets.append(formset)

        adminForm = helpers.AdminForm(form, list(self.get_fieldsets(request)),
                                      self.prepopulated_fields, self.get_readonly_fields(request),
                                      model_admin=self)

        media = self.media + adminForm.media
        inline_admin_formsets = []

        for inline, formset in zip(self.get_inline_instances(request), formsets):
            fieldsets = list(inline.get_fieldsets(request))
            readonly = list(inline.get_readonly_fields(request))
            inline_admin_formset = helpers.InlineAdminFormSet(inline, formset,
                                                              fieldsets, readonly,
                                                              model_admin=self)
            if inline.inlines:
                for form in formset.forms:
                    if form.instance.pk:
                        instance = form.instance
                    else:
                        instance = None

                    form.inlines = inline.get_inlines(request, instance, prefix=form.prefix)

                inline_admin_formset.inlines = inline.get_inlines(request)

            inline_admin_formsets.append(inline_admin_formset)
            media = media + inline_admin_formset.media

        context = {
            'title': _('Add %s') % force_unicode(opts.verbose_name),
            'adminform': adminForm,
            'is_popup': "_popup" in request.REQUEST,
            'show_delete': False,
            'media': mark_safe(media),
            'inline_admin_formsets': inline_admin_formsets,
            'errors': helpers.AdminErrorList(form, formsets),
            'app_label': opts.app_label,
        }

        context.update(extra_context or {})

        return self.render_change_form(request, context, form_url=form_url, add=True)
58284
def application_view(&block)
      template = read_file('layout/application', 'haml')
      Haml::Engine.new(template).render(self, &block)
    end
388089
def views_preview(self, data, **kwargs):
        ""
        api_path = "/api/v2/views/preview.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
124820
public function View ()
	{
		
		// If there is no view then use basic by default
		
		if (!$this->view)
		{
			$this->view		= new View\Basic;
		}
		
		// If there is no template then set default
		
		if (!$this->template)
		{
			$this->template	= $this->view->defaultTemplate ($this->module, $this->controller, $this->action);
		}

		// Assign controller reference

		$this->view->assign ('controller', $this);

		// Display view
		
		$this->view->display ($this->template);
		
	}
956714
function BaseView (properties, application) {

  // note that if application is not defined, this.application will
  // default to the default, global application.
  this.application = application;

  this._onParent     = _.bind(this._onParent, this);
  SubindableObject.call(this, properties);


  /**
   * The main application that instantiated this view
   * @property application
   * @type {Application}
   */

  this.initialize();
  
  // ref back to this context for templates
  this["this"]     = this;
}
697327
def get_object_from_list_detail_view(request, *args, **kwargs):
    
    queryset = kwargs['queryset']
    object_id = kwargs.get('object_id', None)
    slug = kwargs.get('slug', None)
    slug_field = kwargs.get('slug_field', 'slug')
    if object_id:
        obj = get_object_or_404(queryset, pk=object_id)
    elif slug and slug_field:
        obj = get_object_or_404(queryset, **{slug_field: slug})
    else:
        raise AttributeError(
                "Generic detail view must be called with either an "
                "object_id or a slug/slug_field."
            )
    return obj
202640
protected function _initView ()
    {
        // Create default view model, to be used in all templates and layouts
        $this->appView  = new \Zend\View\Model\ViewModel();

        // Convenience access variables
        $this->_appView = $this->appView;
        $this->view     = $this->appView;
        $this->_view    = $this->appView;
    }
199153
def process_view(self, request, view_func, view_args, view_kwargs):
        """"""
        profiler = getattr(request, 'profiler', None)
        if profiler:
            # Make sure profiler variables don't get passed into view_func
            original_get = request.GET
            request.GET = original_get.copy()
            request.GET.pop('profile', None)
            request.GET.pop('show_queries', None)
            request.GET.pop('show_stats', None)
            try:
                return profiler.runcall(
                    view_func, request, *view_args, **view_kwargs
                )
            finally:
                request.GET = original_get