当前位置: 首页>>代码示例>>Python>>正文


Python layout.FormHelper方法代码示例

本文整理汇总了Python中xadmin.layout.FormHelper方法的典型用法代码示例。如果您正苦于以下问题:Python layout.FormHelper方法的具体用法?Python layout.FormHelper怎么用?Python layout.FormHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xadmin.layout的用法示例。


在下文中一共展示了layout.FormHelper方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, *args, **kwargs):
        context = self.get_context()
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        context.update({
            'title': self.title,
            'helper': helper,
            'app_path': request.get_full_path(),
            REDIRECT_FIELD_NAME: request.get_full_path(),
        })
        defaults = {
            'extra_context': context,
            # 'current_app': self.admin_site.name,
            'authentication_form': self.login_form or AdminAuthenticationForm,
            'template_name': self.login_template or 'xadmin/views/login.html',
        }
        self.update_params(defaults)
        # return login(request, **defaults)
        return login.as_view(**defaults)(request) 
开发者ID:Superbsco,项目名称:weibo-analysis-system,代码行数:22,代码来源:website.py

示例2: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, *args, **kwargs):
        context = self.get_context()
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        context.update({
            'title': self.title,
            'helper': helper,
            'app_path': request.get_full_path(),
            REDIRECT_FIELD_NAME: request.get_full_path(),
        })
        defaults = {
            'extra_context': context,
            'current_app': self.admin_site.name,
            'authentication_form': self.login_form or AdminAuthenticationForm,
            'template_name': self.login_template or 'xadmin/views/login.html',
        }
        self.update_params(defaults)
        return login(request, **defaults) 
开发者ID:stormsha,项目名称:StormOnline,代码行数:21,代码来源:website.py

示例3: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, object_id):
        model_fields = [f.name for f in self.opts.fields]
        fields = [f for f in request.GET['fields'].split(',') if f in model_fields]
        defaults = {
            "form": self.form,
            "fields": fields,
            "formfield_callback": self.formfield_for_dbfield,
        }
        form_class = modelform_factory(self.model, **defaults)
        form = form_class(instance=self.org_obj)

        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        form.helper = helper

        s = '{% load i18n crispy_forms_tags %}<form method="post" action="{{action_url}}">{% crispy form %}' + \
            '<button type="submit" class="btn btn-success btn-block btn-sm">{% trans "Apply" %}</button></form>'
        t = template.Template(s)
        c = template.Context({'form': form, 'action_url': self.model_admin_url('patch', self.org_obj.pk)})

        return HttpResponse(t.render(c)) 
开发者ID:stormsha,项目名称:StormOnline,代码行数:24,代码来源:editable.py

示例4: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, *args, **kwargs):
        context = self.get_context()
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        context.update({
            'title': self.title,
            'helper': helper,
            'app_path': request.get_full_path(),
            REDIRECT_FIELD_NAME: request.get_full_path(),
        })
        defaults = {
            'extra_context': context,
            # 'current_app': self.admin_site.name,
            'authentication_form': self.login_form or AdminAuthenticationForm,
            'template_name': self.login_template or 'xadmin/views/login.html',
        }
        self.update_params(defaults)
        return login(request, **defaults) 
开发者ID:myminwang,项目名称:myblog,代码行数:21,代码来源:website.py

示例5: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, *args, **kwargs):
        context = self.get_context()
        helper = FormHelper()
        helper.form_tag = False
        context.update({
            'title': self.title,
            'helper': helper,
            'app_path': request.get_full_path(),
            REDIRECT_FIELD_NAME: request.get_full_path(),
        })
        defaults = {
            'extra_context': context,
            'current_app': self.admin_site.name,
            'authentication_form': self.login_form or AdminAuthenticationForm,
            'template_name': self.login_template or 'xadmin/views/login.html',
        }
        self.update_params(defaults)
        return login(request, **defaults) 
开发者ID:madre,项目名称:devops,代码行数:20,代码来源:website.py

示例6: get

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get(self, request, object_id):
        model_fields = [f.name for f in self.opts.fields]
        fields = [f for f in request.GET['fields'].split(',') if f in model_fields]
        defaults = {
            "form": self.form,
            "fields": fields,
            "formfield_callback": self.formfield_for_dbfield,
        }
        form_class = modelform_factory(self.model, **defaults)
        form = form_class(instance=self.org_obj)

        helper = FormHelper()
        helper.form_tag = False
        form.helper = helper

        s = '{% load i18n crispy_forms_tags %}<form method="post" action="{{action_url}}">{% crispy form %}' + \
            '<button type="submit" class="btn btn-success btn-block btn-sm">{% trans "Apply" %}</button></form>'
        t = template.Template(s)
        c = template.Context({'form': form, 'action_url': self.model_admin_url('patch', self.org_obj.pk)})

        return HttpResponse(t.render(c)) 
开发者ID:madre,项目名称:devops,代码行数:23,代码来源:editable.py

示例7: setup

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def setup(self):
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        self.helper = helper

        self.id = self.cleaned_data['id']
        self.title = self.cleaned_data['title'] or self.base_title

        if not (self.user.is_superuser or self.has_perm()):
            raise PermissionDenied 
开发者ID:stormsha,项目名称:StormOnline,代码行数:13,代码来源:dashboard.py

示例8: context

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def context(self, context):
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False

        context.update({
            'addform': self.add_view.form_obj,
            'addhelper': helper,
            'addurl': self.add_view.model_admin_url('add'),
            'model': self.model
        }) 
开发者ID:stormsha,项目名称:StormOnline,代码行数:13,代码来源:dashboard.py

示例9: get_form_helper

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get_form_helper(self):
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        helper.add_layout(self.get_form_layout())

        return helper 
开发者ID:stormsha,项目名称:StormOnline,代码行数:9,代码来源:form.py

示例10: get_form_helper

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get_form_helper(self):
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        layout = self.get_form_layout()
        replace_field_to_value(layout, self.get_field_result)
        helper.add_layout(layout)
        cls_str = str if six.PY3 else basestring
        helper.filter(cls_str, max_level=20).wrap(ShowField, admin_view=self)
        return helper 
开发者ID:stormsha,项目名称:StormOnline,代码行数:12,代码来源:detail.py

示例11: get_context

# 需要导入模块: from xadmin import layout [as 别名]
# 或者: from xadmin.layout import FormHelper [as 别名]
def get_context(self):
        context = super(ChangePasswordView, self).get_context()
        helper = FormHelper()
        helper.form_tag = False
        helper.include_media = False
        self.form.helper = helper
        context.update({
            'title': _('Change password: %s') % escape(smart_text(self.obj)),
            'form': self.form,
            'has_delete_permission': False,
            'has_change_permission': True,
            'has_view_permission': True,
            'original': self.obj,
        })
        return context 
开发者ID:stormsha,项目名称:StormOnline,代码行数:17,代码来源:auth.py


注:本文中的xadmin.layout.FormHelper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。