flask_admin.form.rules

class BaseRule[源代码]

Base form rule. All form formatting rules should derive from BaseRule.

__init__()[源代码]

x.__init__(…) initializes x; see help(type(x)) for signature

class NestedRule(rules=[], separator='')[源代码]

Nested rule. Can contain child rules and render them.

__init__(rules=[], separator='')[源代码]

Constructor.

参数:
  • rules – Child rule list
  • separator – Default separator between rules when rendering them.
class Text(text, escape=True)[源代码]

Render text (or HTML snippet) from string.

__init__(text, escape=True)[源代码]

Constructor.

参数:
  • text – Text to render
  • escape – Should text be escaped or not. Default is True.
class HTML(html)[源代码]

Shortcut for Text rule with escape set to False.

__init__(html)[源代码]

Constructor.

参数:
  • text – Text to render
  • escape – Should text be escaped or not. Default is True.
class Macro(macro_name, **kwargs)[源代码]

Render macro by its name from current Jinja2 context.

__init__(macro_name, **kwargs)[源代码]

Constructor.

参数:
  • macro_name – Macro name
  • kwargs – Default macro parameters
class Container(macro_name, child_rule, **kwargs)[源代码]

Render container around child rule.

__init__(macro_name, child_rule, **kwargs)[源代码]

Constructor.

参数:
  • macro_name – Macro name that will be used as a container
  • child_rule – Child rule to be rendered inside of container
  • kwargs – Container macro arguments
class Field(field_name, render_field='lib.render_field')[源代码]

Form field rule.

__init__(field_name, render_field='lib.render_field')[源代码]

Constructor.

参数:
  • field_name – Field name to render
  • render_field – Macro that will be used to render the field.
class Header(text, header_macro='lib.render_header')[源代码]

Render header text.

__init__(text, header_macro='lib.render_header')[源代码]

Constructor.

参数:
  • text – Text to render
  • header_macro – Header rendering macro
class FieldSet(rules, header=None, separator='')[源代码]

Field set with header.

__init__(rules, header=None, separator='')[源代码]

Constructor.

参数:
  • rules – Child rules
  • header – Header text
  • separator – Child rule separator