Instanciate the form for the current step

        FormAdminView from xadmin expects form to be at self.form_obj
172919
def get_form(self, step=None, data=None, files=None):
        
        self.form_obj = super(FormWizardAdminView, self).get_form(
            step=step, data=data, files=files)
        return self.form_obj
1344364
def get_form_kwargs(self):
        
        data = super(UserContextFormViewMixin, self).get_form_kwargs()
        data.update({
            'user': self.get_agnocomplete_context(),
        })
        return data
625757
def get_form(self, request, obj=None, **kwargs):
        """"""
        #form = super(PageAdmin, self).get_form(request, obj, **kwargs)
        template = get_template_from_request(request, obj)
        form = make_form(self.model, get_placeholders(template))

        language = get_language_from_request(request)
        form.base_fields['language'].initial = language
        if obj:
            initial_slug = obj.slug(language=language, fallback=False)
            initial_title = obj.title(language=language, fallback=False)
            form.base_fields['slug'].initial = initial_slug
            form.base_fields['title'].initial = initial_title
            form.base_fields['slug'].label = _('Slug')

        template = get_template_from_request(request, obj)
        page_templates = settings.get_page_templates()
        if len(page_templates) > 0:
            template_choices = list(page_templates)
            template_choices.insert(0, (settings.PAGE_DEFAULT_TEMPLATE,
                    _('Default template')))
            form.base_fields['template'].choices = template_choices
            form.base_fields['template'].initial = force_text(template)

        for placeholder in get_placeholders(template):
            name = placeholder.name
            if obj:
                initial = placeholder.get_content(obj, language, name)
            else:
                initial = None
            form.base_fields[name] = placeholder.get_field(obj,
                language, initial=initial)

        for placeholder in self.metadata_fields:
            name = placeholder['name']
            initial = None
            if obj:
                try:
                    initial = Content.objects.get(page=obj, language=language, type=name).body
                except Content.DoesNotExist:
                    pass
            form.base_fields[name] = placeholder['field']
            form.base_fields[name].initial = initial

        return form
676780
def render_next_step(self, form, **kwargs):
        
        next_step = self.get_next_step()
        self.storage.current_step = next_step
        return redirect(self.url_name, step=next_step)
510812
def post(self, *args, **kwargs):
        
        if self.steps.current not in self.steps.all:
            logger.warning("Current step '%s' is no longer valid, returning "
                           "to last valid step in the wizard.",
                           self.steps.current)
            return self.render_goto_step(self.steps.all[-1])

        # -- Duplicated code from upstream
        # Look for a wizard_goto_step element in the posted data which
        # contains a valid step name. If one was found, render the requested
        # form. (This makes stepping back a lot easier).
        wizard_goto_step = self.request.POST.get('wizard_goto_step', None)
        if wizard_goto_step and wizard_goto_step in self.get_form_list():
            return self.render_goto_step(wizard_goto_step)

        # Check if form was refreshed
        management_form = ManagementForm(self.request.POST, prefix=self.prefix)
        if not management_form.is_valid():
            raise SuspiciousOperation(_('ManagementForm data is missing or has been tampered with'))

        form_current_step = management_form.cleaned_data['current_step']
        if (form_current_step != self.steps.current and
                self.storage.current_step is not None):
            # form refreshed, change current step
            self.storage.current_step = form_current_step
        # -- End duplicated code from upstream

        # This is different from the first check, as this checks
        # if the new step is available. See issue #65.
        if self.steps.current not in self.steps.all:
            logger.warning("Requested step '%s' is no longer valid, returning "
                           "to last valid step in the wizard.",
                           self.steps.current)
            return self.render_goto_step(self.steps.all[-1])

        return super(IdempotentSessionWizardView, self).post(*args, **kwargs)
484398
def form(self) -> Optional['HTMLFormElement']:
        """"""
        if self.__form:
            return self.__form
        parent = self.parentNode
        while parent:
            if isinstance(parent, HTMLFormElement):
                return parent
            else:
                parent = parent.parentNode
        return None
973936
def get_initial(self):
        
        initial = super(MultiFormView, self).get_initial()
        for key in six.iterkeys(self.form_classes):
            initial[key] = {}
        return initial
570501
function buildFormLink (args, controller, form, instance) {
    // get model from controller
    var model = controller.model
    // get relation from the model to be linked to to the current instance
    var relation = model.relation(form.model)
    // require relation to continue
    if (!relation) {
        throw new Error('no relation found for form model '+form.model)
    }
    // get relation models
    var relationModel = relation.model
    var viaModel = relation.viaModel
    // link forms can only be created for related models that are linked
    // via another model
    if (!viaModel) {
        throw new Error('no viaModel for relation to form model '+relationModel.name)
    }
    // if input type for form is select then get values for select from
    if (form.inputType === 'select') {
        // get input args
        var input = requireValidOptionalObject(form.input)
        // option value property is either specified or id
        var optionValueProperty = defined(input.optionValueProperty) ?  input.optionValueProperty : 'id'
        // option title is either specified or it - should be specified
        var optionTitleProperty = defined(input.optionTitleProperty) ?  input.optionTitleProperty : 'id'
        // build args for query
        var queryArgs = {
            all: true,
            session: args.session,
        }
        // merge any args from form
        _.merge(queryArgs, form.query)
        // load reladed records
        return relationModel.query(queryArgs)
        // create from with select built from related records
        .then(records => {
            // list of select options
            var options = _.map(records, record => {
                // title for select option
                var title
                // resolve title string from record if set
                if (defined(input.optionTitle)) {
                    title = resolveVariables(input.optionTitle, record)
                }
                // otherwise use property name
                else {
                    // try to get title from record
                    title = _.get(record, optionTitleProperty)
                    // try to get title from data if not in record
                    if (!defined(title)) {
                        title = _.get(record.data, optionTitleProperty)
                    }
                }
                // try to get value from record
                var value = _.get(record, optionValueProperty)
                // try to get value from data if not in record
                if (!defined(value)) {
                    value = _.get(record.data, optionValueProperty)
                }
                // return select option
                return {
                    title: title,
                    value: value,
                }
            })
            // build field
            var field = {
                inputType: 'select',
                label: relationModel.title,
                name: 'relationId',
                options: options,
                property: 'relationId',
            }
            // create form
            var form = new ImmutableCoreModelForm({
                action: './'+instance.id+'/link',
                fields: [
                    field,
                    {
                        name: 'relation',
                        property: 'relation',
                        value: relationModel.name,
                        inputType: 'hidden',
                    },
                ],
                method: 'POST',
                model: model,
                submit: {
                    title: 'Add '+relationModel.title,
                },
                title: 'Add '+relationModel.title,
            })
            // resolve with form
            return form
        })
    }
}
264800
def save_form(self, request, form, change):
        
        OwnableAdmin.save_form(self, request, form, change)
        return DisplayableAdmin.save_form(self, request, form, change)
202158
def get_form_instance(self, request, data=None, instance=None):
        
        defaults = {}
        if self.form:
            defaults['form'] = self.form
        if self.fields:
            defaults['fields'] = self.fields
        return modelform_factory(self.model, **defaults)(data=data, instance=instance)
1330339
def _get_form(self, config_name, only_required=False):
        """"""
        if getattr(self, config_name, None):
            return import_object_by_string(getattr(self, config_name))

        def use_field(field):
            if not only_required:
                return True
            return field.default == NOT_PROVIDED

        return modelform_factory(self.model, fields=[f.name for f in self.model.get_fields() if use_field(f)])
637498
def init_form_view(self, view, opts):
        
        name = opts.get("name", opts.get("form"))
        if isinstance(name, Form):
            return

        template = opts.get("template", getattr(view, "template", None))
        if not template:
            if not name:
                raise NoFormError("No form name specified in the form action and no template")
            return

        try:
            as_ = opts.get("var_name", getattr(self.form, "as_", "form"))
            form_class = create_from_template(current_app, template, var_name=as_)
        except NoFormError:
            if not name:
                raise
            return

        if not name:
            name = view.name

        self.forms[name] = form_class
        self.form_created_from_view_signal.send(self, view=view, form_class=form_class)
        return form_class
1218556
public function initForm()
	{
		$this->form = tao_helpers_form_FormFactory::getForm('import');
	    
		$this->form->setActions(is_null($this->subForm) ? array() : $this->subForm->getActions('top'), 'top');
	    $this->form->setActions(is_null($this->subForm) ? array() : $this->subForm->getActions('bottom'), 'bottom');
				 
	}
1096416
def save_form(self, request, form, change):
        """"""
        instance = super(PageAdmin, self).save_form(request, form, change)
        instance.template = form.cleaned_data['template']
        if not change:
            instance.author = request.user
        return instance
1015330
def get_form():
    
    global form_class
    from fluent_comments import appsettings
    if form_class is None:
        if appsettings.FLUENT_COMMENTS_FORM_CLASS:
            from django.utils.module_loading import import_string
            form_class = import_string(appsettings.FLUENT_COMMENTS_FORM_CLASS)
        else:
            from fluent_comments.forms import FluentCommentForm
            form_class = FluentCommentForm

    return form_class
1011003
function checkFormAssociation(req, res, next){
  var requestedFormId = req.params.id;
  req.appformsResultPayload = req.appformsResultPayload || {};
  var formsAssociatedWithProject = req.appformsResultPayload.data || [];

  var foundForm = _.find(formsAssociatedWithProject, function(formId){
    return requestedFormId === formId;
  });

  //Form Associated, can get the form
  if(foundForm){
    return next();
  }  else{
    return next(new Error("Invalid Form Request. Form Not Associated With The Project"));
  }
}
294518
def render_next_step(self, form, **kwargs):
        
        # get the form instance based on the data from the storage backend
        # (if available).
        next_step = self.steps.next
        new_form = self.get_form(next_step,
            data=self.storage.get_step_data(next_step),
            files=self.storage.get_step_files(next_step))

        # change the stored current step
        self.storage.current_step = next_step
        return self.render(new_form, **kwargs)