Creates an instance to be saved when a model is created.
16256
def _create_one(self, ctx):
        
        assert isinstance(ctx, ResourceQueryContext)

        fields = dict_pick(ctx.data, self._model_columns)
        model = self.model_cls(**fields)
        return model
1252886
def create(self, **kwargs):
        
        if self.created:
            raise RuntimeError(
                '{} already created.'.format(self.__model_type__.__name__))

        kwargs = self.merge_kwargs(self._create_kwargs, kwargs)

        self._inner = self.helper.create(
            self.name, *self._create_args, **kwargs)
286152
async def create(self, model_, **data):
        
        inst = model_(**data)
        query = model_.insert(**dict(inst.__data__))

        pk = await self.execute(query)
        if inst._pk is None:
            inst._pk = pk
        return inst
1039979
function (req, res) {
        var {name} = new {modelName}({{createFields}
        });

        {name}.save(function (err, {name}) {
            if (err) {
                return res.status(500).json({
                    message: 'Error when creating {name}',
                    error: err
                });
            }
            return res.status(201).json({name});
        });
    }
1236302
def save(self, *args, **kwargs):
        
        self.__class__.objects.exclude(id=self.id).delete()
        super(SingletonModel, self).save(*args, **kwargs)
776809
def create(self, validated_data):
        
        if self.context.get('parent_field') \
            and self.context.get('parent_instance'):
            validated_data.update({
                self.context.get('parent_field'):
                self.context.get('parent_instance')})
        instance = self.Meta.model(**validated_data)
        instance.full_clean()
        instance.save()
        return instance
1017486
def _create(cls, model_class, *args, **kwargs):
        """"""
        if cls._meta.django_get_or_create:
            return cls._get_or_create(model_class, *args, **kwargs)

        manager = cls._get_manager(model_class)
        return manager.create(*args, **kwargs)
432947
function StartableModel(model,instance) {
    if(!model) {
        throw new Error('model is required')
    }
    if(!instance) {
        throw new Error('instance is required')
    }
    if(!(this instanceof StartableModel)) {
        return new StartableModel(model,instance,index)
    }
    this.model = model
    this.key = model.key
    this.instance= instance
    this.fn = instance[model.startable]
    if(!this.fn) {
        throw new Error('The instance of ' +
                        this.key +
                        ' does not have a method ' +
                        model.startable +
                       ' which is required for starting this service.')
    }
    this.inject = (this.fn.inject || [])
    this.hasDeps = (this.inject.length > 0)
}
1150502
def create_model(self, parent, name, multiplicity=Multiplicity.ZERO_MANY):
        
        return self._client.create_model(parent, name, multiplicity=multiplicity)
103561
def create(self, *args, **kwargs):
        """"""
        href = self.url
        if len(args) == 1:
            kwargs[self.model_class.primary_key] = args[0]
            href = '/'.join([href, args[0]])
        model = self.model_class(self,
                                 href=href.replace('classifications/', 'classification/'),
                                 data=kwargs)
        model.create(**kwargs)
        self._models.append(model)
        return model
8477
def create(self, **kwargs):
        
        obj = self.model(**kwargs)
        meta = obj.get_meta()
        meta.connection = get_es_connection(self.es_url, self.es_kwargs)
        meta.index=self.index
        meta.type=self.type
        obj.save(force=True)
        return obj
419449
def save(self):
        

        # handle polymorphic models
        if self._is_polymorphic:
            if self._is_polymorphic_base:
                raise PolymorphicModelException('cannot save polymorphic base model')
            else:
                setattr(self, self._discriminator_column_name, self.__discriminator_value__)

        self.validate()
        self.__dmlquery__(self.__class__, self,
                          batch=self._batch,
                          ttl=self._ttl,
                          timestamp=self._timestamp,
                          consistency=self.__consistency__,
                          if_not_exists=self._if_not_exists,
                          conditional=self._conditional,
                          timeout=self._timeout,
                          if_exists=self._if_exists).save()

        self._set_persisted()

        self._timestamp = None

        return self
1135008
def create(self, **kwargs):
        
        obj = self.model(**kwargs)
        obj.save(force_insert=True, using=self._using)
        return obj
594625
def create(self, data, fields=[], models={}):
        '''
        
        '''
        if not fields: fields = self.fields
        if not models and hasattr(self, 'models'): models = self.models
        for field in fields:
            setattr(self,field,None)
        if not data: return None
        for k, v in data.iteritems():
            if type(v) in (str, unicode):
                v = v.strip()
            if models and k in models:
                if type(v) == dict:
                    lists = []
                    for k2, v2 in v.iteritems():
                        if type(v2) == list:
                            for d in v2:
                                model = models[k]()
                                lists.append(model.create(d))
                    if not lists:
                        model = models[k]()
                        v = model.create(v)
                    else:
                        v = lists
                else:
                    model = models[k]()
                    v = model.create(v)
            setattr(self,k,v)
        return self
515640
def pre_save(self, model_instance, add):
        
        file = getattr(model_instance, self.attname)
        if file and not file._committed:
            file.name = self._clean_file_name(model_instance, file.name)
            file.file = self._resize_image(model_instance, file)
            file.save(file.name, file, save=False)
        return file
1307855
def create_model(self, ModelName, PrimaryContainer, *args, **kwargs):  # pylint: disable=unused-argument
        
        LocalSagemakerClient._models[ModelName] = _LocalModel(ModelName, PrimaryContainer)
1263613
protected void save(Model model, String filename) {
        try {
            ModelSerializer.writeModel(model, filename, true);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }