Creates a new model.
If creation is successful, the browser will be redirected to the 'view' page.
336681
public function actionGet() 
	{
		if(Yii::app()->request->isAjaxRequest) {
			$criteria=new CDbCriteria; 
			$criteria->condition = 'publish = :publish'; 
			$criteria->params = array(':publish'=>1); 
			$criteria->order = 'creation_date DESC'; 

			$dataProvider = new CActiveDataProvider('OmmuWalls', array( 
				'criteria'=>$criteria, 
				'pagination'=>array( 
					'pageSize'=>5, 
				), 
			));
			
			$data = '';
			$wall = $dataProvider->getData();
			if(!empty($wall)) {
				foreach($wall as $key => $item) {
					$data .= Utility::otherDecode($this->renderPartial('_view', array('data'=>$item), true, false));
				}
			}
			$pager = OFunction::getDataProviderPager($dataProvider);
			if($pager[nextPage] != '0') {
				$summaryPager = 'Displaying 1-'.($pager[currentPage]*$pager[pageSize]).' of '.$pager[itemCount].' results.';
			} else {
				$summaryPager = 'Displaying 1-'.$pager[itemCount].' of '.$pager[itemCount].' results.';
			}
			$nextPager = $pager['nextPage'] != 0 ? Yii::app()->controller->createUrl('get', array($pager['pageVar']=>$pager['nextPage'])) : 0;
			
			$return = array(
				'type'=>0,
				'data'=>$data,
				'pager'=>$pager,
				'summarypager'=>$summaryPager,
				'nextpage'=>$nextPager,
			);
			echo CJSON::encode($return);
			
		} else
			throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
	}
799405
def create(self, **kwargs):
        

        response = self.ghost.execute_post('%s/' % self._type_name, json={
            self._type_name: [
                kwargs
            ]
        })

        return self._model_type(response.get(self._type_name)[0])
730824
public function createAction()
    {
        if (! $this->isMultiTracks()) {
            // Fix for double pressing of create button
            $request = $this->getRequest();
            $model   = $this->getModel();

            $model->setFilter(array()) // First clear existing filter
                    ->applyRequest($request);
            $data = $model->loadFirst();

            if ($data) {
                $this->_reroute(array($request->getActionKey() => 'edit-track'));
                return;
            }
        }

        if ($this->createSnippets) {
            $params = $this->_processParameters($this->createParameters + $this->createEditParameters);

            $this->addSnippets($this->createSnippets, $params);
        }
    }
616825
public function actionCreate()
    {
        $form = new DomainForm();
        if ($form->load(Yii::$app->request->post()) && $form->validate()) {
            try {
                $model = $this->service->create($form);
                return $this->redirect(['view', 'id' => $model->id]);
            } catch (\DomainException $e) {
                Yii::$app->errorHandler->logException($e);
                Yii::$app->session->setFlash('error', $e->getMessage());
            }
        }
        return $this->render('create', [
            'model' => $form,
        ]);
    }
1135008
def create(self, **kwargs):
        
        obj = self.model(**kwargs)
        obj.save(force_insert=True, using=self._using)
        return obj
726637
public function newAction()
    {
        $model = $this->loadModel();
        if (!$model->isObjectNew()) {
            $this->_forward('noroute');
            return;
        }

        if ($this->getRequest()->isPost()) {
            $postData = $this->getRequest()->getPost();
            try {
                $model->isObjectNew(true);
                foreach ($this->preprocessPostData($postData) as $key => $value) {
                    $model->setDataUsingMethod($key, $value);
                }
                $model->save();
                $this->_redirectUrl($this->getHelper()->getGridUrl());
                $this->_getSession()->addSuccess('Saved Successfully');
                return;
            } catch (Exception $e) {
                $message = $e->getMessage();
                if ($e instanceof Zend_Db_Statement_Exception && $e->getChainedException() instanceof PDOException) {
                    /** @var PDOException $e */
                    $e = $e->getChainedException();
                    if (isset($e->errorInfo[0]) && $e->errorInfo[0] == 23000 && isset($e->errorInfo[1]) && $e->errorInfo[1] == 1062) {
                        $message = $this->getHelper()->__(
                            "Record already exists for %s '%s'",
                            $model->getIdFieldName(),
                            $model->getId()
                        );
                    }
                }
                Mage::logException($e);
                $this->_getSession()->addError($message);
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
726530
public function actionCustomCreate()
    {
        $model = new Options();
        $model->type = Options::TYPE_CUSTOM;
        if ($model->load(yii::$app->getRequest()->post()) && $model->save()) {
            yii::$app->getSession()->setFlash('success', yii::t('cms', 'Success'));
            return $this->redirect(['custom']);
        } else {
            $errors = $model->getErrors();
            $err = '';
            foreach ($errors as $v) {
                $err .= $v[0] . '<br>';
            }
            //Yii::$app->getSession()->setFlash('error', yii::t('cms', $err));
            yii::$app->getResponse()->format = Response::FORMAT_JSON;
            return [
                'err_msg' => $err,
            ];
        }
    }
522487
public function actionCreate()
    {
        $model = Yii::createObject($this->modelClass);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', Yii::t('yii2mod.cms', 'Page has been created.'));

            return $this->redirect(['index']);
        }

        return $this->render($this->createView, [
            'model' => $model,
        ]);
    }
701406
public function create() {
        if ($this->overrideAction('create')) {
            return;
        }

        $this->AdminToolbar->setBelongsToData($this->Model);
        $this->AdminToolbar->setHabtmData($this->Model);

        if ($this->request->is('post')) {
            $data = $this->AdminToolbar->getRequestData();
            $this->Model->create();

            if ($this->Model->saveAll($data, array('validate' => 'first', 'atomic' => true, 'deep' => true))) {
                $this->Model->set($data);
                $this->AdminToolbar->logAction(ActionLog::CREATE, $this->Model, $this->Model->id);

                $this->AdminToolbar->setFlashMessage(__d('admin', 'Successfully created a new %s', mb_strtolower($this->Model->singularName)));
                $this->AdminToolbar->redirectAfter($this->Model);

            } else {
                $this->AdminToolbar->setFlashMessage(__d('admin', 'Failed to create a new %s', mb_strtolower($this->Model->singularName)), 'is-error');
            }
        }

        $this->overrideView('create');
    }
14003
public function actionCreate()
    {
        $model = new Client();
        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        } else if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('oauth2', 'Successful operation'));
            return $this->redirect(['view', 'id' => $model->client_id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
450355
def create
      authorize model

      @resource = model.new(creation_params)
      @resource.assign_attributes(**reflections_hash) unless reflections_hash.nil?

      # Customize the create behaviour
      before_create_hook(@resource)

      # TODO: Handle M2M relations in here
      if @resource.save
        after_create_hook(@resource)
        successful_response(:create)
      else
        errorful_resopnse(:create, @resource.errors) do
          redirect_to Rails.application.routes.url_helpers.send(@new_route)
        end
      end
    end
684024
public function actionCreate()
    {
        $model = new Article();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('article', 'Create success.'));
            return $this->redirect(['view', 'id' => $model->id]);
        }
        return $this->render('create', [
            'model' => $model,
        ]);
    }
897866
def perform_create(self, data):
        

        instance = self.model(**data)
        self.request.dbsession.add(instance)
        self.request.dbsession.flush()
        return instance
578223
def create_object(
        request, model=None, template_name=None,
        template_loader=loader, extra_context=None, post_save_redirect=None,
        login_required=False, context_processors=None, form_class=None):
    
    if extra_context is None:
        extra_context = {}
    if login_required and not request.user.is_authenticated:
        return redirect_to_login(request.path)

    model, form_class = get_model_and_form_class(model, form_class)
    if request.method == 'POST':
        form = form_class(request.POST, request.FILES)
        if form.is_valid():
            new_object = form.save()

            msg = ugettext("The %(verbose_name)s was created successfully.") %\
                {"verbose_name": model._meta.verbose_name}
            messages.success(request, msg, fail_silently=True)
            return redirect(post_save_redirect, new_object)
    else:
        form = form_class()

    # Create the template, context, response
    if not template_name:
        template_name = "%s/%s_form.html" % (
            model._meta.app_label, model._meta.object_name.lower())
    t = template_loader.get_template(template_name)
    c = {
        'form': form,
    }
    apply_extra_context(extra_context, c)
    return HttpResponse(t.render(context=c, request=request))
358085
function initModelNew (args) {
    var controller = this
    var model = this.model
    // if model/controller does not have form then cannot create new controller
    if (!this.form) {
        return
    }
    // create path if it does not exist
    if (!this.paths['/new']) {
        this.paths['/new'] = {}
    }
    // get accountId column
    var accountIdColumn = model.columnName('accountId') 
    // set role to authenticated if model requires account id
    var role = args.defaultRole || (accountIdColumn && model.columns[accountIdColumn].null === false ? 'authenticated' : 'all')
    // form inputs
    var input = {
        redirect: 'query.redirect',
    }
    // input may include pre-filled form values
    input[model.name] = 'query.'+model.name
    // add handler for GET /new
    this.paths['/new'].get = [
        {
            before: function (args) {
                return newInstance(controller, args)
            },
            input: input,
            method: function (args) {
                return {form: args.form}
            },
            methodName: 'new',
            role: role,
            template: 'instance',
        },
    ]
}
361686
def create_view(self, callback, method, request=None):
        
        view = super(WaldurSchemaGenerator, self).create_view(callback, method, request)
        if is_disabled_action(view):
            view.exclude_from_schema = True

        return view
1200749
def generate_create_view(self):
        """"""

        name = model_class_form(self.model + 'CreateView')
        create_args = dict(
            form_class=self.get_actual_form('create'),
            model=self.get_model_class,
            template_name=self.get_template('create'),
            permissions=self.view_permission('create'),
            permission_required=self.check_permission_required,
            login_required=self.check_login_required,
            inlineformset=self.inlineformset,
            success_url=reverse_lazy('{}-{}-list'.format(self.app, self.custom_postfix_url)),
            custom_form=self.createupdate_forms or self.custom_modelform,
            custom_postfix_url=self.custom_postfix_url
        )

        parent_classes = [self.get_createupdate_mixin(), CreateView]
        if self.custom_create_view_mixin:
            parent_classes.insert(0, self.custom_create_view_mixin)

        create_class = type(
            name,
            tuple(parent_classes),
            create_args
        )

        self.classes[name] = create_class
        return create_class