Creates a new object with the given kwargs, saving it to the database
        and returning the created object.
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
150271
def save(self, *args, **kwargs):
        """"""
        method_kwargs = self._get_method_kwargs()
        try:
            subscription = Subscription.objects.get(**method_kwargs)
        except Subscription.DoesNotExist:
            subscription = Subscription.objects.create(**method_kwargs)
        return subscription
176366
def create(cls, data=None, api_key=None, endpoint=None, add_headers=None,
               **kwargs):
        """"""
        cls.validate(data)
        inst = cls(api_key=api_key)
        endpoint = ''
        return inst.request('POST',
                            endpoint=endpoint,
                            data=data,
                            query_params=kwargs,
                            add_headers=add_headers,
                            )
387101
def create(cls, data, **kwargs):
        """"""
        with db.session.begin_nested():
            model = cls.dbmodel(**kwargs)
            model.data = data
            obj = cls(model)
            db.session.add(obj.model)
        return obj
50656
def create(self, type_, *args, **kwargs) -> Any:
        
        attribute = type_(self, *args, **kwargs)
        self._table.append(attribute)
        return attribute
1315057
def create(cls, *args, **kwargs) -> 'Entity':
        
        logger.debug(
            f'Creating new `{cls.__name__}` object using data {kwargs}')

        model_cls = repo_factory.get_model(cls)
        repository = repo_factory.get_repository(cls)

        try:
            # Build the entity from the input arguments
            # Raises validation errors, if any, at this point
            entity = cls(*args, **kwargs)

            # Do unique checks, create this object and return it
            entity._validate_unique()

            # Perform Pre-Save Actions
            entity.pre_save()

            # Build the model object and create it
            model_obj = repository.create(model_cls.from_entity(entity))

            # Update the auto fields of the entity
            for field_name, field_obj in entity.meta_.declared_fields.items():
                if isinstance(field_obj, Auto):
                    if isinstance(model_obj, dict):
                        field_val = model_obj[field_name]
                    else:
                        field_val = getattr(model_obj, field_name)
                    setattr(entity, field_name, field_val)

            # Set Entity status to saved
            entity.state_.mark_saved()

            # Perform Post-Save Actions
            entity.post_save()

            return entity
        except ValidationError:
            # FIXME Log Exception
            raise
1215790
def create(self, **kwargs):
        
        Statement = self.get_model('statement')
        Tag = self.get_model('tag')

        session = self.Session()

        tags = set(kwargs.pop('tags', []))

        if 'search_text' not in kwargs:
            kwargs['search_text'] = self.tagger.get_bigram_pair_string(kwargs['text'])

        if 'search_in_response_to' not in kwargs:
            in_response_to = kwargs.get('in_response_to')
            if in_response_to:
                kwargs['search_in_response_to'] = self.tagger.get_bigram_pair_string(in_response_to)

        statement = Statement(**kwargs)

        for tag_name in tags:
            tag = session.query(Tag).filter_by(name=tag_name).first()

            if not tag:
                # Create the tag
                tag = Tag(name=tag_name)

            statement.tags.append(tag)

        session.add(statement)

        session.flush()

        session.refresh(statement)

        statement_object = self.model_to_object(statement)

        self._session_finish(session)

        return statement_object
478929
async def create_object(model, **data):
    
    # NOTE! Here are internals involved:
    #
    # - obj._data
    # - obj._get_pk_value()
    # - obj._set_pk_value()
    # - obj._prepare_instance()
    #
    warnings.warn("create_object() is deprecated, Manager.create() "
                  "should be used instead",
                  DeprecationWarning)

    obj = model(**data)

    pk = await insert(model.insert(**dict(obj.__data__)))

    if obj._pk is None:
        obj._pk = pk
    return obj
976404
def create(cls, class_name, **attributes):
        
        object_class = cls.extend(class_name)
        return object_class(**attributes)
1026034
def create(cls, user_id, github_id=None, name=None, **kwargs):
        """"""
        with db.session.begin_nested():
            obj = cls(user_id=user_id, github_id=github_id, name=name,
                      **kwargs)
            db.session.add(obj)
        return obj
1173528
async def create_or_get(self, model_, **kwargs):
        
        try:
            return (await self.create(model_, **kwargs)), True
        except IntegrityErrors:
            query = []
            for field_name, value in kwargs.items():
                field = getattr(model_, field_name)
                if field.unique or field.primary_key:
                    query.append(field == value)
            return (await self.get(model_, *query)), False
562300
def create(self, **kwargs):
        
        Statement = self.get_model('statement')
        Tag = self.get_model('tag')

        tags = kwargs.pop('tags', [])

        if 'search_text' not in kwargs:
            kwargs['search_text'] = self.tagger.get_bigram_pair_string(kwargs['text'])

        if 'search_in_response_to' not in kwargs:
            if kwargs.get('in_response_to'):
                kwargs['search_in_response_to'] = self.tagger.get_bigram_pair_string(kwargs['in_response_to'])

        statement = Statement(**kwargs)

        statement.save()

        tags_to_add = []

        for _tag in tags:
            tag, _ = Tag.objects.get_or_create(name=_tag)
            tags_to_add.append(tag)

        statement.tags.add(*tags_to_add)

        return statement
599171
def init_object(self, args, kwargs):
        
        self.object_id = kwargs.pop(self.pk, None)
        if self.object_id is not None:
            self.obj = self.Model.query.get(self.object_id)
            actions.context["object"] = self.obj

        return args, kwargs
234421
def create(self, fields):
        
        try:
            # Cleaning the fields, and check if has `ForeignKey` type.
            cleaned_fields = {}
            for key, value in fields.items():
                if type(value) is dict:
                    try:
                        if value['type'] == 'fk':
                            fake_fk = self.fake_fk(value['field_name'])
                            cleaned_fields.update({key: fake_fk})
                    except:
                        pass
                else:
                    cleaned_fields.update({key: value})

            # Creating the object from dictionary fields.
            model_class = self.model_class()
            obj = model_class.objects.create(**cleaned_fields)

            # The `ManyToManyField` need specific object,
            # so i handle it after created the object.
            for key, value in fields.items():
                if type(value) is dict:
                    try:
                        if value['type'] == 'm2m':
                            self.fake_m2m(obj, value['field_name'])
                    except:
                        pass
            try:
                obj.save_m2m()
            except:
                obj.save()
            return obj
        except Exception as e:
            raise e
600134
def create(cls):
        

        class NewPopupCreateView(PopupCreateView, cls.parent_class):
            model = cls.model
            form_class = cls.form_class
            popup_name = cls.get_class_verbose_name()
            template_name = cls.get_template_name_create()
            permission_required = cls.get_permission_required('create')

            def get_context_data(self, **kwargs):
                kwargs.update(cls.context_for_all)
                kwargs.update(cls.context_for_create)
                return super(NewPopupCreateView, self).get_context_data(**kwargs)

        return NewPopupCreateView
83580
async def create(self, **kwargs):
        '''
        
        '''
        try:
            # create model
            obj = self._meta.object_class()
            # deserialize data from request body
            self.data.update(kwargs)
            await obj.deserialize(self.data)
            # create document in DB
            await obj.insert(db=self.db)
            # serialize object for response
            return await obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)
113410
async def save(self, db):
        
        kwargs = {}
        for col in self._auto_columns:
            if not self.has_real_data(col.name):
                kwargs[col.name] = await col.auto_generate(db, self)
        self.__dict__.update(kwargs)

        # we have to delete the old index key
        stale_object = await self.__class__.load(db, identifier=self.identifier())
        d = {
            k: (v.strftime(DATETIME_FORMAT) if isinstance(v, datetime) else v)
            for k, v in self.__dict__.items()
        }
        success = await db.hmset_dict(self.redis_key(), d)
        await self.save_index(db, stale_object=stale_object)
        return success