get view model data from the card
188102
function (params, state, cb) {
                  state = state || {};

                  if (Card.getCardData) {
                    Card.getCardData(params, state, function (err, viewModel, clientLocals) {
                      cb(err, params, state, viewModel, clientLocals);
                    });
                  }
                  else {
                    cb(null, params, state, null, null);
                  }
                }
1130899
def view_for(self, action='view'):
        
        app = current_app._get_current_object()
        view, attr = self.view_for_endpoints[app][action]
        return getattr(view(self), attr)
1316792
private function loadDashboardCards()
	{
		// Fetch all the dashboard cards for the current user
		$model = UserMetadata::model()->getPrototype('UserMetadata', array(
		             'user_id' => $this->user->id,
		             'key' => 'dashboard_cards'
		         ), array('value' => '{}'));

		$model->value = CJSON::decode($model->value);

		return $model;
	}
1164947
def get_view_names(self, connection, schema=None, **kw):
        
        return self._get_table_or_view_names('v', connection, schema, **kw)
424409
function (params, viewModel, clientLocals, cb) {
                  viewModel = viewModel || {};
                  clientLocals = clientLocals || {};

                  var generateOptions = {
                    directory: options.directory,
                    packName: options.packName,
                    cardName: options.cardName,
                    url: options.url,
                    key: params.cardKey,
                    title: viewModel.title || '',
                    link: viewModel.link,
                    css: params.light !== true,
                    client$Support: Card.client$Support || false,
                    clientStateSupport: Card.clientStateSupport || false,
                    clientProxySupport: Card.clientProxySupport || false,
                    clientAnalyticsSupport: Card.clientAnalyticsSupport || false,
                    viewModel: viewModel,
                    clientLocals: clientLocals
                  };

                  generateCardDocument(generateOptions, function (html) {
                    cb(null, html);
                  });
                }
1172158
def print_model(self):
        
        cards = [c.card for c in self.cards]
        # If there is only one card, print it as a single
        # card not as a list
        if len(cards) == 1:
            cards = cards[0]
        cards_json = json.dumps(cards, indent=1)
        return cards_json
291169
def get_data(self, query, fields_convert_map, encoding='utf-8', auto_convert=True,
                 include_hidden=False, header=None):
        
        fields_convert_map = fields_convert_map or {}
        d = self.fields_convert_map.copy() 
        d.update(fields_convert_map)

        if isinstance(query, Select):
            query = do_(query)
        
        # def get_value(name, value, record):
        #     convert = d.get(name)
        #     if convert:
        #         value = convert(value, record)
        #     return safe_unicode(value, encoding)
        
        for record in query:
            self._cal_sum(record)
            row = []
            record = self._get_record(record)
            if self.before_record_render:
                self.before_record_render(record)
            if isinstance(record, orm.Model):
                model = record.__class__
            else:
                model = None
                
            for i, x in enumerate(self.table_info['fields_list']):
                field = get_field(x['name'], model)
                if not field:
                    field = {'name':x['name']}
                else:
                    field = {'name':x['name'], 'prop':field}
                if not include_hidden and x.get('hidden'):
                    continue
                if isinstance(record, orm.Model):
                    v = make_view_field(field, record, fields_convert_map=d, 
                        auto_convert=auto_convert)
                else:
                    v = make_view_field(field, record, fields_convert_map=d, 
                        auto_convert=auto_convert, value=record[x['name']])
                value = v['display']
                #value = safe_unicode(v['display'], encoding)
                row.append(value)
                
            if header:
                ret = dict(zip(header, row))
            else:
                ret = row
            yield ret

        total = self._get_sum()
        if total:
            row = []
            for x in total:
                v = x
                if isinstance(x, str):
                    v = safe_unicode(x, encoding)
                row.append(v)
            if header:
                ret = dict(zip(header, row))
            else:
                ret = row
            yield ret
1077740
function ViewModel(view, data, key, opts) {
	var vm = this;

	vm.view = view;
	vm.data = data;
	vm.key = key;

	if (opts) {
		vm.opts = opts;
		vm.cfg(opts);
	}

	var out = isPlainObj(view) ? view : view.call(vm, vm, data, key, opts);

	if (isFunc(out))
		{ vm.render = out; }
	else {
		vm.render = out.render;
		vm.cfg(out);
	}

	vm.init && vm.init.call(vm, vm, vm.data, vm.key, opts);
}
78635
def view_get(method_name):
    

    def view_get(_value, context, **_params):
        method = getattr(context["view"], method_name)
        return _get(method, context["key"], (), {})

    return view_get
1315457
private String getViewContent(final Map<String, Object> dataModel) {
        if (null == configuration) {
            initTemplateEngineCfg();
        }

        try {
            final Template template = configuration.getTemplate("plugin.ftl");
            final StringWriter sw = new StringWriter();

            template.process(dataModel, sw);

            return sw.toString();
        } catch (final Exception e) {
            // This plugin has no view

            return "";
        }
    }
696711
def get_data(self, entity):
        """"""
        data = self._filter_queryset('view_data', entity.data.all())

        return self._serialize_data(data)
193337
def get_view(self, request, view_class, opts=None):
        
        kwargs = {}
        if opts:
            if not isinstance(opts, dict):
                opts = opts.__dict__
        else:
            opts = {}

        if not view_class in VALID_MIXIN_OPTIONS:
            valid_options = view_class.__dict__.keys()
            for cls in view_class.__bases__:
                if cls != object:
                    valid_options += cls.__dict__.keys()
            VALID_MIXIN_OPTIONS[view_class] = valid_options

        for key in VALID_MIXIN_OPTIONS[view_class]:
            if key in opts:
                kwargs[key] = opts[key]
            elif hasattr(self, key):
                kwargs[key] = getattr(self, key)

        view = view_class(**kwargs)
        view.request = request
        view.kwargs = {}
        return view
1029395
function(model) {
		var _d = this._d; // quicker lookup
		if (!_d.hasData) {
			// if we've never rendered data yet, queue up a reset collection
			// this probably means we just finished our very first fetch
			// reset needed to clear out loading / no data state..
			return this.resetCollection();
		}
		_d.modelChanges[model.cid] = {t: 'add', m: model};
		this.updateViews();
	}
314595
public function getViewsData() {
    $data = parent::getViewsData();
    $data['mentions_field_data']['table']['base']['help'] = t('Mentions entry');

    $data['mentions_field_data']['table']['wizard_id'] = 'mention';
    $data['mentions_field_data']['mid']['field']['id'] = 'mid';

    $data['mentions_field_data']['table']['group'] = t('Mentions');
    $data['mentions_field_data']['table']['entity type'] = 'mentions';

    $data['mentions_field_data']['table']['base']['title'] = t('Mentions');

    $data['mentions_field_data']['table']['base']['weight'] = 1;
    $data['mentions_field_data']['table']['base']['defaults']['field'] = 'mid';

    $data['mentions_field_data']['mid'] = [
      'title' => t('Mention ID'),
      'help' => t('Mention ID'),
      'field' => [
        'id' => 'numeric',
      ],
    ];

    $data['mentions_field_data']['entity_type'] = [
      'title' => t('Entity type'),
      'help' => t('Entity type of entity that contains mention'),
      'field' => [
        'id' => 'standard',
      ],
      'filter' => [
        'id' => 'standard',
      ],
    ];

    $data['mentions_field_data']['title'] = [
      'title' => t('Title'),
      'help' => t('Title of entity containing mention'),
      'real field' => 'mid',
      'field' => [
        'id' => 'mentions_title',
      ],
      'relationship' => [
        'base' => 'node_field_data',
        'base field' => 'title',
        'relationship field' => 'nid',
        'title' => t('Mention Title'),
        'help' => t('Mention Title'),
        'id' => 'standard',
        'label' => t('Mention Title'),
      ],
    ];

    $data['mentions_field_data']['auid'] = [
      'title' => t('Author user id'),
      'help' => t('Author user id'),
      'filter' => [
        'id' => 'standard',
      ],
      'argument' => [
        'id' => 'standard',
      ],
      'field' => [
        'id' => 'standard',
      ],
      'relationship' => [
        'base' => 'users',
        'title' => t('User'),
        'help' => t('The user that authored the mention'),
        'id' => 'standard',
        'label' => t('Mentions user'),
      ],
    ];

    $data['mentions_field_data']['uid'] = [
      'title' => t('Mentioned user uid'),
      'help' => t('The user that is mentioned'),
      'relationship' => [
        'base' => 'users',
        'title' => t('User'),
        'help' => t('The user that is mentioned'),
        'id' => 'standard',
        'label' => t('Mentions user'),
      ],
      'filter' => [
        'id' => 'standard',
      ],
      'argument' => [
        'id' => 'standard',
      ],
      'field' => [
        'id' => 'standard',
      ],
    ];

    $data['mentions_field_data']['created'] = [
      'title' => t('Date'),
      'help' => t('Date'),
      'field' => [
        'id' => 'date',
      ],
      'sort' => [
        'id' => 'date',
      ],
      'argument' => [
        'id' => 'date',
      ],
    ];

    $data['mentions_field_data']['entity_id'] = [
      'title' => t('Entity id'),
      'help' => t('The unique ID of the object that contains mention'),
      'field' => [
        'id' => 'standard',
      ],
      'sort' => [
        'id' => 'standard',
      ],
      'argument' => [
        'id' => 'numeric',
      ],
    ];

    $data['mentions_field_data']['link'] = [
      'title' => t('Link'),
      'real field' => 'mid',
      'help' => t('Link to entity that contains mention'),
      'field' => [
        'id' => 'mentions_link',
      ],
    ];

    return $data;
  }
921473
function getTemplateModel(prefix, resource, appName) {
    var methods = {};

    // if no api or browser apiclient, then return null since we will skip
    if (!resource.api || resource.adapters.browser !== 'apiclient') {
        return null;
    }

    // loop through API routes and create method objects for the template
    _.each(resource.api, function (urlMappings, httpMethod) {
        _.each(urlMappings, function (methodName, url) {
            methods[methodName] = {
                httpMethod: httpMethod,
                url: url
            };
        });
    });

    return {
        resourceName:   resource.name,
        appName:        this.getAppModuleName(prefix, appName),
        serviceName:    this.pancakes.utils.getCamelCase(resource.name + '.service'),
        modelName:      this.pancakes.utils.getPascalCase(resource.name),
        methods:        JSON.stringify(methods)
    };
}
965240
function getViewsOf(model) {
        return getRefsTo(model, function (ref) {
            return (ref instanceof Core.View) && (ref.model === model);
        });
    }
1144419
function getModel (app, name, Model) {
  const mongooseClient = app.get('mongoose');
  assert(mongooseClient, 'mongoose client not set by app');
  const modelNames = mongooseClient.modelNames();
  if (modelNames.includes(name)) {
    return mongooseClient.model(name);
  } else {
    assert(Model && typeof Model === 'function', 'Model function not privided.');
    return Model(app, name);
  }
}