hawat.blueprints.groups.forms module

This module contains custom group management forms for Hawat.

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

Bases: 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 hawat.blueprints.groups.forms.AdminCreateGroupForm(*args, **kwargs)[source]

Bases: AdminBaseGroupForm

Class representing group create form for administrators.

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

Bases: AdminBaseGroupForm

Class representing group update form for administrators.

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

Bases: BaseItemForm

Class representing base group form.

cancel = <UnboundField(SubmitField, (l'Cancel',), {})>
description = <UnboundField(StringField, (l'Description:',), {'validators': [<wtforms.validators.DataRequired object>, <function check_null_character>], '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 hawat.blueprints.groups.forms.GroupSearchForm(*args, **kwargs)[source]

Bases: 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>, <function check_null_character>], 'filters': [<function GroupSearchForm.<lambda>>, <method 'strip' of 'str' objects>], '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 hawat.blueprints.groups.forms.UpdateGroupForm(*args, **kwargs)[source]

Bases: BaseGroupForm

Class representing group update form for regular users.

hawat.blueprints.groups.forms.check_name_existence(_form, field)[source]

Callback for validating user logins during account create action.

hawat.blueprints.groups.forms.check_name_uniqueness(form, field)[source]

Callback for validating user logins during account update action.

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

Callback for validating that parent group is not self.

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

Format option for selection of user accounts.

hawat.blueprints.groups.forms.get_available_groups()[source]

Query the database for list of all available groups.