API Docs

User profiles module for Invenio.

class invenio_userprofiles.ext.InvenioUserProfiles(app=None)[source]

Invenio-UserProfiles extension.

Extension initialization.

init_app(app)[source]

Flask application initialization.

init_config(app)[source]

Initialize configuration.

Admin

Admin views for invenio-userprofiles.

class invenio_userprofiles.admin.UserProfileView(model, session, name=None, category=None, endpoint=None, url=None, static_folder=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None)[source]

Userprofiles view. Links User ID to user/full/display name.

Constructor.

Parameters:
  • model – Model class
  • session – SQLAlchemy session
  • name – View name. If not set, defaults to the model name
  • category – Category name
  • endpoint – Endpoint name. If not set, defaults to the model name
  • url – Base URL. If not set, defaults to ‘/admin/’ + endpoint
  • menu_class_name – Optional class name for the menu item.
  • menu_icon_type

    Optional icon. Possible icon types:

    • flask_admin.consts.ICON_TYPE_GLYPH - Bootstrap glyph icon
    • flask_admin.consts.ICON_TYPE_FONT_AWESOME - Font Awesome icon
    • flask_admin.consts.ICON_TYPE_IMAGE - Image relative to Flask static directory
    • flask_admin.consts.ICON_TYPE_IMAGE_URL - Image with full URL
  • menu_icon_value – Icon glyph name or URL, depending on menu_icon_type setting
action_view(*args, **kwargs)

Mass-model action view.

ajax_update(*args, **kwargs)

Edits a single column of a record in list view.

create_view(*args, **kwargs)

Create model view

delete_view(*args, **kwargs)

Delete model view. Only POST method is allowed.

details_view(*args, **kwargs)

Details model view

edit_view(*args, **kwargs)

Edit model view

index_view(*args, **kwargs)

List view

API

API for user profiles.

invenio_userprofiles.api.current_userprofile

Proxy to the current_userprofile.

Forms

Forms for user profiles.

class invenio_userprofiles.forms.EmailProfileForm(formdata=<class 'flask_wtf.form._Auto'>, obj=None, prefix='', csrf_context=None, secret_key=None, csrf_enabled=None, **kwargs)[source]

Form to allow editing of email address.

class invenio_userprofiles.forms.ProfileForm(formdata=<class 'flask_wtf.form._Auto'>, obj=None, prefix='', csrf_context=None, secret_key=None, csrf_enabled=None, **kwargs)[source]

Form for editing user profile.

validate_username(form, field)[source]

Wrap username validator for WTForms.

class invenio_userprofiles.forms.VerificationForm(formdata=<class 'flask_wtf.form._Auto'>, obj=None, prefix='', csrf_context=None, secret_key=None, csrf_enabled=None, **kwargs)[source]

Form to render a button to request email confirmation.

invenio_userprofiles.forms.confirm_register_form_factory(Form)[source]

Return extended confirmation of registration form.

invenio_userprofiles.forms.current_user_email(form, field)[source]

Stop validation if email equals current user’s email.

invenio_userprofiles.forms.register_form_factory(Form)[source]

Return extended registration form.

invenio_userprofiles.forms.strip_filter(text)[source]

Filter for trimming whitespace.

Parameters:text – The text to strip.
Returns:The stripped text.

Validators for user profiles.

invenio_userprofiles.validators.USERNAME_RULES = lu'Username must start with a letter, be at least three characters long and only contain alphanumeric characters, dashes and underscores.'

Description of username validation rules.

Note

Used for both form help text and for form validation error.

invenio_userprofiles.validators.username_regex = <_sre.SRE_Pattern object>

Username rules.

invenio_userprofiles.validators.validate_username(username)[source]

Validate the username.

See invenio_userprofiles.validators.username_regex to know which rules are applied.

Parameters:username – The user name.
Raises:ValueError – If validation fails.

Views

Invenio module that adds userprofiles to the platform.

invenio_userprofiles.views.handle_profile_form(form)[source]

Handle profile update form.

invenio_userprofiles.views.handle_verification_form(form)[source]

Handle email sending verification form.

invenio_userprofiles.views.init_common(app)[source]

Post initialization.

invenio_userprofiles.views.profile(*args, **kwargs)[source]

View for editing profile.

invenio_userprofiles.views.profile_form_factory()[source]

Create a profile form.

invenio_userprofiles.views.userprofile(value)[source]

Retrieve user profile for a given user id.