Add forms into the context dictionary.
541681
def get_context_data(self, **kwargs):
        
        context = {}
        if 'forms' not in kwargs:
            context['forms'] = self.get_forms()
        else:
            context['forms'] = kwargs['forms']
        return context
1153802
def bind(self, form):
        """"""
        field = self.field(default=self.default, **self.field_kwargs)
        form._fields[self.name] = field.bind(form, self.name, prefix=form._prefix)
215084
def cli_form(self, *args):
        """"""

        if args[0] == '*':
            for schema in schemastore:
                self.log(schema, ':', schemastore[schema]['form'], pretty=True)
        else:
            self.log(schemastore[args[0]]['form'], pretty=True)
761424
def update_context(app, pagename, templatename, context, doctree):  # pylint: disable=unused-argument
    
    context['feedback_form_url'] = feedback_form_url(app.config.project, pagename)
1236772
def formfield(self, form_class=None, choices_form_class=None, **kwargs):
        """"""
        defaults = {
            'form_class': form_class or self.get_form_class()
        }
        defaults.update(kwargs)

        return super(ListField, self).formfield(**defaults)
98631
def values(self):
        """"""
        args = []
        for d in self.args, self.form:
            if not isinstance(d, MultiDict):
                d = MultiDict(d)
            args.append(d)
        return CombinedMultiDict(args)
1349325
def cli_forms(self, *args):
        """"""

        forms = []
        missing = []

        for key, item in schemastore.items():
            if 'form' in item and len(item['form']) > 0:
                forms.append(key)
            else:
                missing.append(key)

        self.log('Schemata with form:', forms)
        self.log('Missing forms:', missing)
193204
def populate_obj(self, obj=None, form=None):
        
        if not form:
            form = current_context.data.form
        if obj is None:
            obj = AttrDict()
        form.populate_obj(obj)
        return obj
747617
def new_context(environment, template_name, blocks, vars=None,
                shared=None, globals=None, locals=None):
    """"""
    if vars is None:
        vars = {}
    if shared:
        parent = vars
    else:
        parent = dict(globals or (), **vars)
    if locals:
        # if the parent is shared a copy should be created because
        # we don't want to modify the dict passed
        if shared:
            parent = dict(parent)
        for key, value in iteritems(locals):
            if value is not missing:
                parent[key] = value
    return environment.context_class(environment, parent, template_name,
                                     blocks)
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)
1179045
def init_with_context(self, context):
        
        # Apply the include/exclude patterns:
        listitems = self._visible_models(context['request'])

        # Convert to a similar data structure like the dashboard icons have.
        # This allows sorting the items identically.
        models = [
            {'name': model._meta.model_name,
             'app_name': model._meta.app_label,
             'title': capfirst(model._meta.verbose_name_plural),
             'url': self._get_admin_change_url(model, context)
             }
            for model, perms in listitems if self.is_item_visible(model, perms)
        ]

        # Sort models.
        sort_cms_models(models)

        # Convert to items
        for model in models:
            self.children.append(items.MenuItem(title=model['title'], url=model['url']))
1314930
def saveform(cls, form):
        

        columns = dict()
        for name, field in cls.form_fields.iteritems():
            columns[name] = getattr(form, field).data
        instance = cls(**columns)
        return instance.save()
667273
def comment_form(context, object):
    
    user = context.get("user")
    form_class = context.get("form", CommentForm)
    form = form_class(obj=object, user=user)
    return form
736630
def get_form(self, form, name):
        
        kwargs = self.get_kwargs(form, name)
        form_class = self.get_form_class(form, name)
        composite_form = form_class(
            data=form.data if form.is_bound else None,
            files=form.files if form.is_bound else None,
            **kwargs)
        return composite_form
878775
def add_context(self, context, label=None):
        

        assert isinstance(context, dict)

        item = defaults["common"].copy()
        item.update(defaults["instance"])
        item.update(context)

        item["family"] = None
        item["label"] = context["data"].get("label") or settings.ContextLabel
        item["itemType"] = "instance"
        item["isToggled"] = True
        item["optional"] = False
        item["hasCompatible"] = True

        item = self.add_item(item)
        self.instances.append(item)
1212895
protected function add_defaults() {
        $mform =& $this->_form;
        $strrequired = get_string('required');

        $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->id : 0);
        $mform->setType('edit', PARAM_INT);
        $mform->addElement('hidden', 'new',   $this->plugin);
        $mform->setType('new', PARAM_ALPHANUMEXT);
        $mform->addElement('hidden', 'plugin', $this->plugin);
        $mform->setType('plugin', PARAM_PLUGIN);
        $mform->addElement('hidden', 'typeid', $this->typeid);
        $mform->setType('typeid', PARAM_INT);
        $mform->addElement('hidden', 'contextid', $this->contextid);
        $mform->setType('contextid', PARAM_INT);

        $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"');
        $mform->addRule('name', $strrequired, 'required', null, 'client');
        $mform->setType('name', PARAM_TEXT);
    }
1305128
def _set_up_context(cls):
        """"""
        cls.context = AttributeDict()
        cls.context.new_meta = {}
        cls.context.new_transitions = {}
        cls.context.new_methods = {}