vial.blueprints.groups.forms module

This module contains custom group management forms for Hawat.

class vial.blueprints.groups.forms.AdminBaseGroupForm(*args, **kwargs)[source]

Bases: vial.blueprints.groups.forms.BaseGroupForm

Class representing group create form.

enabled = <UnboundField(RadioField, (l'State:',), {'validators': [<wtforms.validators.InputRequired object>], 'choices': [(True, l'Enabled'), (False, l'Disabled')], 'filters': [<function str_to_bool>], 'coerce': <function str_to_bool>, 'description': l'Boolean flag whether the group is enabled or disabled. Disabled groups are hidden to the most of the system features.'})>
managers = <UnboundField(QuerySelectMultipleField, (l'Managers:',), {'query_factory': <function get_available_users>, 'get_label': <function format_select_option_label_user>, 'blank_text': l'<< no selection >>', 'description': l'List of users acting as group managers. These users may change various group settings.'})>
parent = <UnboundField(QuerySelectField, (l'Parent group:',), {'validators': [<wtforms.validators.Optional object>, <function check_parent_not_self>], 'query_factory': <function get_available_groups>, 'allow_blank': True, 'blank_text': l'<< no selection >>', 'description': l'Parent group for this group. This feature enables the posibility to create structured group hierarchy.'})>
class vial.blueprints.groups.forms.AdminCreateGroupForm(*args, **kwargs)[source]

Bases: vial.blueprints.groups.forms.AdminBaseGroupForm

Class representing group create form for administrators.

name = <UnboundField(StringField, (l'Name:',), {'validators': [<wtforms.validators.DataRequired object>, <wtforms.validators.Length object>, <function check_unique_group>], 'description': l'System-wide unique name for the group.'})>
class vial.blueprints.groups.forms.AdminUpdateGroupForm(*args, **kwargs)[source]

Bases: vial.blueprints.groups.forms.AdminBaseGroupForm

Class representing group update form for administrators.

name = <UnboundField(StringField, (l'Name:',), {'validators': [<wtforms.validators.DataRequired object>, <wtforms.validators.Length object>, <function check_unique_group>], 'description': l'System-wide unique name for the group.'})>
class vial.blueprints.groups.forms.BaseGroupForm(*args, **kwargs)[source]

Bases: vial.forms.BaseItemForm

Class representing base group form.

cancel = <UnboundField(SubmitField, (l'Cancel',), {})>
description = <UnboundField(StringField, (l'Description:',), {'validators': [<wtforms.validators.DataRequired object>], 'description': l'Additional and more extensive group description.'})>
members = <UnboundField(QuerySelectMultipleField, (l'Members:',), {'query_factory': <function get_available_users>, 'get_label': <function format_select_option_label_user>, 'blank_text': l'<< no selection >>', 'description': l'List of group members.'})>
source = <UnboundField(HiddenField, (), {'default': 'manual', 'validators': [<wtforms.validators.DataRequired object>, <wtforms.validators.Length object>], 'description': l'Origin of the group record, whether it was added manually, or via some automated mechanism from data from some third party system.'})>
submit = <UnboundField(SubmitField, (l'Submit',), {})>
class vial.blueprints.groups.forms.GroupSearchForm(*args, **kwargs)[source]

Bases: vial.forms.BaseSearchForm

Class representing simple user search form.

dt_from = <UnboundField(SmartDateTimeField, (l'Creation time from:',), {'validators': [<wtforms.validators.Optional object>], 'description': l'Lower time boundary for item creation time. Timestamp is expected to be in the format <code>YYYY-MM-DD hh:mm:ss</code> and in the timezone according to the user`s preferences.'})>
dt_to = <UnboundField(SmartDateTimeField, (l'Creation time to:',), {'validators': [<wtforms.validators.Optional object>], 'description': l'Upper time boundary for item creation time. Timestamp is expected to be in the format <code>YYYY-MM-DD hh:mm:ss</code> and in the timezone according to the user`s preferences.'})>
static is_multivalue(field_name)[source]

Check, if given form field is a multivalue field.

Parameters

field_name (str) – Name of the form field.

Returns

True, if the field can contain multiple values, False otherwise.

Return type

bool

managers = <UnboundField(QuerySelectField, (l'Group managers:',), {'query_factory': <function get_available_users>, 'allow_blank': True, 'description': l'Search for groups with particular managers.'})>
members = <UnboundField(QuerySelectField, (l'Group members:',), {'query_factory': <function get_available_users>, 'allow_blank': True, 'description': l'Search for groups with particular members.'})>
search = <UnboundField(StringField, (l'Name, description:',), {'validators': [<wtforms.validators.Optional object>, <wtforms.validators.Length object>], 'description': l'Group`s full name or description. Search is performed even in the middle of the strings.'})>
sortby = <UnboundField(SelectField, (l'Sort by:',), {'validators': [<wtforms.validators.Optional object>], 'choices': [('createtime.desc', l'by creation time descending'), ('createtime.asc', l'by creation time ascending'), ('name.desc', l'by name descending'), ('name.asc', l'by name ascending')], 'default': 'name.asc'})>
source = <UnboundField(SelectField, (l'Record source:',), {'validators': [<wtforms.validators.Optional object>], 'default': '', 'description': l'Search for groups coming from particular sources/feeds.'})>
state = <UnboundField(SelectField, (l'State:',), {'validators': [<wtforms.validators.Optional object>], 'choices': [('', l'Nothing selected'), ('enabled', l'Enabled'), ('disabled', l'Disabled')], 'default': '', 'description': l'Search for groups with particular state.'})>
class vial.blueprints.groups.forms.UpdateGroupForm(*args, **kwargs)[source]

Bases: vial.blueprints.groups.forms.BaseGroupForm

Class representing group update form for regular users.

vial.blueprints.groups.forms.check_parent_not_self(form, field)[source]

Callback for validating that parent group is not self.

vial.blueprints.groups.forms.format_select_option_label_user(item)[source]

Format option for selection of user accounts.