The 'add' admin view for this model.
487738
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 = []
        inline_instances = self.get_inline_instances(request, None)
        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 self.get_formsets_with_inlines(request):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1
                if prefixes[prefix] != 1 or not prefix:
                    prefix = "%s-%s" % (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.get_queryset(request))
                formsets.append(formset)
                if inline.inlines:
                    self.add_nested_inline_formsets(request, inline, formset)
            if self.all_valid_with_nesting(formsets) and form_validated:
                self.save_model(request, new_object, form, False)
                self.save_related(request, form, formsets, False)
                args = ()
                # Provide `add_message` argument to ModelAdmin.log_addition for
                # Django 1.9 and up.
                if VERSION[:2] >= (1, 9):
                    add_message = self.construct_change_message(
                        request, form, formsets, add=True
                    )
                    args = (request, new_object, add_message)
                else:
                    args = (request, new_object)
                self.log_addition(*args)
                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 self.get_formsets_with_inlines(request):
                prefix = FormSet.get_default_prefix()
                prefixes[prefix] = prefixes.get(prefix, 0) + 1
                if prefixes[prefix] != 1 or not prefix:
                    prefix = "%s-%s" % (prefix, prefixes[prefix])
                formset = FormSet(instance=self.model(), prefix=prefix,
                    queryset=inline.get_queryset(request))
                formsets.append(formset)
                if hasattr(inline, 'inlines') and inline.inlines:
                    self.add_nested_inline_formsets(request, inline, formset)

        adminForm = helpers.AdminForm(form, list(self.get_fieldsets(request)),
            self.get_prepopulated_fields(request),
            self.get_readonly_fields(request),
            model_admin=self)
        media = self.media + adminForm.media

        inline_admin_formsets = []
        for inline, formset in zip(inline_instances, formsets):
            fieldsets = list(inline.get_fieldsets(request))
            readonly = list(inline.get_readonly_fields(request))
            prepopulated = dict(inline.get_prepopulated_fields(request))
            inline_admin_formset = helpers.InlineAdminFormSet(inline, formset,
                fieldsets, prepopulated, readonly, model_admin=self)
            inline_admin_formsets.append(inline_admin_formset)
            media = media + inline_admin_formset.media
            if hasattr(inline, 'inlines') and inline.inlines:
                media += self.wrap_nested_inline_formsets(request, inline, formset)

        context = {
            'title': _('Add %s') % force_text(opts.verbose_name),
            'adminform': adminForm,
            'is_popup': "_popup" in request.GET,
            'show_delete': False,
            'media': media,
            'inline_admin_formsets': inline_admin_formsets,
            'errors': helpers.AdminErrorList(form, formsets),
            'app_label': opts.app_label,
            }
        context.update(self.admin_site.each_context(request))
        context.update(extra_context or {})
        return self.render_change_form(request, context, form_url=form_url, add=True)
299616
protected function createAdminMenu(): void
    {
        $menu = $this->menu();
        $events = $this->app->make('events');

        $handlers = [
            UserMenuHandler::class,
            ExtensionMenuHandler::class,
            SettingMenuHandler::class,
        ];

        $menu->add('home')
            ->title(\trans('orchestra/foundation::title.home'))
            ->link($this->handles('orchestra::/'))
            ->icon('home');

        foreach ($handlers as $handler) {
            $events->listen('orchestra.started: admin', $handler);
        }
    }
98640
def change_view(self, request, object_id, **kwargs):
        
        instance = get_object_or_404(self.concrete_model, pk=object_id)
        content_model = instance.get_content_model()

        self.check_permission(request, content_model, "change")

        if content_model.__class__ != self.model:
            change_url = admin_url(content_model.__class__, "change",
                                   content_model.id)
            return HttpResponseRedirect(change_url)

        return super(ContentTypedAdmin, self).change_view(
            request, object_id, **kwargs)
1138640
def change_view(self, *args, **kwargs):
        """"""
        Hierarchy.init_hierarchy(self)

        self.hierarchy.hook_change_view(self, args, kwargs)

        return super(HierarchicalModelAdmin, self).change_view(*args, **kwargs)
1338073
def add_manager_view(request):
    '''  '''
    form = ManagerForm(request.POST or None)
    if form.is_valid():
        manager = form.save()
        messages.add_message(request, messages.SUCCESS,
                             MESSAGES['MANAGER_ADDED'].format(managerTitle=manager.title))
        return HttpResponseRedirect(reverse('managers:add_manager'))
    return render_to_response('edit_manager.html', {
        'page_name': "Admin - Add Manager",
        'managerset': Manager.objects.all(),
        'form': form,
        }, context_instance=RequestContext(request))
1137082
def add_view_info(self, view_info: ViewInfo):
        ''''''
        try:
            next(info for info in self._view_infos if info.view == view_info.view)
        except StopIteration:
            indent = len(self._view_infos) * '\t'
            self._view_infos.append(view_info)
            info = 'Line {0} in "{1}"'.format(view_info.line, view_info.view)
            self.add_info(indent + 'View info', info)
539184
def add_view(self, request, form_url='', extra_context=None):
        """"""
        extra_context = {
            'language': get_language_from_request(request),
            'page_languages': settings.PAGE_LANGUAGES,
        }
        return super(PageAdmin, self).add_view(request, form_url,
                                               extra_context)
251662
def custom_add_user_view(request):
    '''  '''
    page_name = "Admin - Add User"
    add_user_form = AddUserForm(request.POST or None, initial={
        'status': UserProfile.RESIDENT,
        })
    if add_user_form.is_valid():
        add_user_form.save()
        message = MESSAGES['USER_ADDED'].format(
            username=add_user_form.cleaned_data["username"])
        messages.add_message(request, messages.SUCCESS, message)
        return HttpResponseRedirect(reverse('custom_add_user'))
    return render_to_response('custom_add_user.html', {
        'page_name': page_name,
        'add_user_form': add_user_form,
        'members': User.objects.all().exclude(username=ANONYMOUS_USERNAME),
        }, context_instance=RequestContext(request))
356267
public function actionAdd() 
	{
		$setting = BannerSetting::model()->findByPk(1, array(
			'select' => 'banner_file_type',
		));
		$banner_file_type = unserialize($setting->banner_file_type);
		if(empty($banner_file_type))
			$banner_file_type = array();
		
		$model=new Banners;

		// Uncomment the following line if AJAX validation is needed
		$this->performAjaxValidation($model);

		if(isset($_POST['Banners'])) {
			$model->attributes=$_POST['Banners'];

			if($model->save()) {
				Yii::app()->user->setFlash('success', Yii::t('phrase', 'Banner success created.'));
				$this->redirect(array('manage'));
			}
		}

		$this->pageTitle = Yii::t('phrase', 'Create Banner');
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('admin_add', array(
			'model'=>$model,
			'banner_file_type'=>$banner_file_type,
		));
	}
386026
def add_announcement_view(request):
    """"""
    if request.method == "POST":
        form = AnnouncementForm(request.POST)
        logger.debug(form)
        if form.is_valid():
            obj = form.save()
            obj.user = request.user
            # SAFE HTML
            obj.content = safe_html(obj.content)
            obj.save()
            announcement_posted_hook(request, obj)
            messages.success(request, "Successfully added announcement.")
            return redirect("index")
        else:
            messages.error(request, "Error adding announcement")
    else:
        form = AnnouncementForm()
    return render(request, "announcements/add_modify.html", {"form": form, "action": "add"})
689946
public function actionAdmin()
	{
		$model=new Post('search');
		if(isset($_GET['Post']))
			$model->attributes=$_GET['Post'];
		$this->render('admin',array(
			'model'=>$model,
		));
	}
767172
protected function addField()
    {
        $this->controlAccess('field_add');

        if ($this->field->add($this->getSubmitted())) {
            $this->redirect('admin/content/field', $this->text('Field has been added'), 'success');
        }

        $this->redirect('', $this->text('Field has not been added'), 'warning');
    }
398836
protected function addReview()
    {
        $this->controlAccess('review_add');

        if ($this->review->add($this->getSubmitted())) {
            $this->redirect('admin/content/review', $this->text('Review has been added'), 'success');
        }

        $this->redirect('', $this->text('Review has not been added'), 'warning');
    }
419356
def add_view(self, view_name, handler):
        
        # 如果不是BaseHandler的子类则不加入
        if is_subclass(handler, BaseHandler):
            self.views.append((view_name, handler))
927336
def _load_income_model(self):
        
        self._add_model(self.income, self.state.income, IncomeModel)
339647
public function addNewLangToDb()
    {
        //reset max count
        $this->_iCurrentMaxLangId = null;

        $table = $this->getAllTables();

        foreach ($table as $tableName) {
            $this->addNewMultilangField($tableName);
        }

        //updating views
        $this->updateViews();
    }
382021
public function add()
    {
        $record = $this->addNewModel();
        $form = $this->addGetForm($record);

        if ($form->execute()) {
            $this->addRedirect($record);
        }

        $this->getView()->set('item', $record);
        $this->getView()->set('form', $form);
        $this->getView()->set('title', $this->getModelManager()->getLabel('add'));

        $this->getView()->Breadcrumbs()
            ->addItem($this->getModelManager()->getLabel('add'));

        $this->getView()->TinyMCE()->setEnabled();
        $this->getView()->append('section', '.add');
    }