Registration

Todo

Docstrings (module, models, utilities, statistics)

Models

class indico.modules.events.registration.models.registrations.Registration(**kwargs)

Bases: flask_sqlalchemy.Model

Somebody’s registration for an event through a registration form

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

base_price

The base registration fee (that is not specific to form items)

billable_data
can_be_modified
checked_in

Whether the person has checked in. Setting this also sets or clears checked_in_dt.

checked_in_dt

The date/time when the person has checked in

currency

Registration price currency

data

The registration this data is associated with

data_by_field
display_full_name

Return the full name using the user’s preferred name format.

email

The email of the registrant

event

The Event containing this registration

event_id

The ID of the event

first_name

The first name of the registrant

friendly_id

The human-friendly ID for the object

full_name

Returns the user’s name in ‘Firstname Lastname’ notation.

classmethod get_all_for_event(event)

Retrieve all registrations in all registration forms of an event.

get_full_name(last_name_first=True, last_name_upper=False, abbrev_first_name=False)

Returns the user’s in the specified notation.

If not format options are specified, the name is returned in the ‘Lastname, Firstname’ notation.

Note: Do not use positional arguments when calling this method. Always use keyword arguments!

Parameters:
  • last_name_first – if “lastname, firstname” instead of “firstname lastname” should be used
  • last_name_upper – if the last name should be all-uppercase
  • abbrev_first_name – if the first name should be abbreviated to use only the first character
get_personal_data()
has_files
id

The ID of the object

is_active
is_cancelled
is_deleted

If the registration has been deleted

is_paid

Returns whether the registration has been paid for.

last_name

The last name of the registrant

locator

Defines a smart locator property.

This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.

This decorator should usually be applied to a method named locator as this name is required for get_locator to find it automatically when just passing the object.

If you need more than one locator, you can define it like this:

@locator_property
def locator(self):
    return {...}

@locator.other
def locator(self):
    return {...}

The other locator can then be accessed by passing obj.locator.other to the code expecting an object with a locator.

order_by_name = (<sqlalchemy.sql.functions.Function at 0x7fe119ce04d0; lower>, <sqlalchemy.sql.functions.Function at 0x7fe119ce0550; lower>, <sqlalchemy.orm.attributes.InstrumentedAttribute object>)
price

The total price of the registration.

This includes the base price, the field-specific price, and the custom price adjustment for the registrant.

Return type:Decimal
price_adjustment

The price modifier applied to the final calculated price

registration_form_id

The ID of the registration form

render_base_price()
render_price()
render_price_adjustment()
sections_with_answered_fields
state

The state a registration is in

submitted_dt

The date/time when the registration was recorded

summary_data

Export registration data nested in sections and fields

sync_state(_skip_moderation=True)

Sync the state of the registration

ticket_uuid

The unique token used in tickets

transaction

The latest payment transaction associated with this registration

transaction_id

The ID of the latest payment transaction associated with this registration

update_state(approved=None, paid=None, rejected=None, _skip_moderation=False)

Update the state of the registration for a given action

The accepted kwargs are the possible actions. True means that the action occured and False that it was reverted.

user
user_id

The ID of the user who registered

uuid

The unguessable ID for the object

class indico.modules.events.registration.models.registrations.RegistrationData(**kwargs)

Bases: indico.core.storage.models.StoredFileMixin, flask_sqlalchemy.Model

Data entry within a registration for a field in a registration form

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

add_file_date_column = False
content_type

The MIME type of the file

created_dt = None
data

The submitted data for the field

field_data

The associated field data object

field_data_id

The ID of the field data

file
file_required = False
filename

The name of the file

friendly_data
get_friendly_data(**kwargs)
locator

Defines a smart locator property.

This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.

This decorator should usually be applied to a method named locator as this name is required for get_locator to find it automatically when just passing the object.

If you need more than one locator, you can define it like this:

@locator_property
def locator(self):
    return {...}

@locator.other
def locator(self):
    return {...}

The other locator can then be accessed by passing obj.locator.other to the code expecting an object with a locator.

price
registration_id

The ID of the registration

render_price()
size

The size of the file (in bytes).

Automatically assigned when save() is called.

storage_backend
storage_file_id
summary_data
user_data
class indico.modules.events.registration.models.registrations.RegistrationState

Bases: indico.util.struct.enum.RichIntEnum

complete = 1
pending = 2
rejected = 3
unpaid = 5
withdrawn = 4
class indico.modules.events.registration.models.form_fields.RegistrationFormField(**kwargs)

Bases: indico.modules.events.registration.models.items.RegistrationFormItem

A registration form field

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

calculate_price(registration_data)
children
current_data
current_data_id
data
data_versions
description
field_impl

Gets the implementation of the field.

Returns:An instance of a RegistrationFormFieldBase subclass
get_friendly_data(registration_data, **kwargs)
html_field_name
id
input_type
is_deleted
is_enabled
is_manager_only
is_required
locator
parent_id
personal_data_type
position
registration_form_id
title
type
versioned_data
view_data
class indico.modules.events.registration.models.form_fields.RegistrationFormFieldData(**kwargs)

Bases: flask_sqlalchemy.Model

Description of a registration form field

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

field_id

The ID of the registration form field

id

The ID of the object

versioned_data

Data describing the field

class indico.modules.events.registration.models.form_fields.RegistrationFormPersonalDataField(**kwargs)

Bases: indico.modules.events.registration.models.form_fields.RegistrationFormField

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

children
current_data
current_data_id
data
data_versions
description
html_field_name
id
input_type
is_deleted
is_enabled
is_manager_only
is_required
parent_id
personal_data_type
position
registration_form_id
title
type
view_data
class indico.modules.events.registration.models.forms.ModificationMode

Bases: indico.util.struct.enum.RichIntEnum

allowed_always = 1
allowed_until_payment = 2
not_allowed = 3
class indico.modules.events.registration.models.forms.RegistrationForm(**kwargs)

Bases: flask_sqlalchemy.Model

A registration form for an event

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

active_fields
active_registrations
base_price

The base fee users have to pay when registering

can_submit(user)
contact_info

Contact information for registrants

currency

Currency for prices in the registration form

disabled_sections
end_dt

Datetime when the registration form is closed

event

The Event containing this registration form

event_id

The ID of the event

form_items
get_personal_data_field_id(personal_data_type)

Returns the field id corresponding to the personal data field with the given name.

get_registration(*args, **kwargs)

Retrieves registrations for this registration form by user or uuid

has_ended
has_started
id

The ID of the object

introduction
invitations

The registration invitations associated with this form

is_active
is_deleted

Whether the registration has been marked as deleted

is_modification_allowed(registration)

Checks whether a registration may be modified

is_modification_open
is_open
is_participation
is_scheduled
limit_reached
locator
manager_notification_recipients

List of emails that should receive management notifications

manager_notifications_enabled

Whether the manager notifications for this event are enabled

message_complete

Custom message to include in emails for complete registrations

message_pending

Custom message to include in emails for pending registrations

message_unpaid

Custom message to include in emails for unpaid registrations

moderation_enabled

Whether registrations must be approved by a manager

modification_end_dt

Datetime when the modification period is over

modification_mode

Whether registration modifications are allowed

notification_sender_address

Notifications sender address

publish_checkin_enabled

Whether checked-in status should be displayed in the event pages and participant list

publish_registration_count

Whether to display the number of registrations

publish_registrations_enabled

Whether registrations should be displayed in the participant list

registration_limit

Maximum number of registrations allowed

registrations

The registrations associated with this form

render_base_price()
require_login

Whether users must be logged in to register

require_user

Whether registrations must be associated with an Indico account

sections
sender_address
start_dt

Datetime when the registration form is open

ticket_on_email

Whether to send tickets by e-mail

ticket_on_event_page

Whether to show a ticket download link on the event homepage

ticket_on_summary_page

Whether to show a ticket download link on the registration summary page

tickets_enabled

Whether tickets are enabled for this form

title

The title of the registration form

class indico.modules.events.registration.models.invitations.InvitationState

Bases: indico.util.struct.enum.RichIntEnum

accepted = 1
declined = 2
pending = 0
class indico.modules.events.registration.models.invitations.RegistrationInvitation(**kwargs)

Bases: flask_sqlalchemy.Model

An invitation for someone to register

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

affiliation

The affiliation of the invited person

email

The email of the invited person

first_name

The first name of the invited person

id

The ID of the invitation

last_name

The last name of the invited person

locator

Defines a smart locator property.

This behaves pretty much like a normal read-only property and the decorated function should return a dict containing the necessary data to build a URL for the object.

This decorator should usually be applied to a method named locator as this name is required for get_locator to find it automatically when just passing the object.

If you need more than one locator, you can define it like this:

@locator_property
def locator(self):
    return {...}

@locator.other
def locator(self):
    return {...}

The other locator can then be accessed by passing obj.locator.other to the code expecting an object with a locator.

registration

The associated registration

registration_form_id

The ID of the registration form

registration_id

The ID of the registration (if accepted)

skip_moderation

Whether registration moderation should be skipped

state

The state of the invitation

uuid

The UUID of the invitation

class indico.modules.events.registration.models.items.PersonalDataType

Bases: int, indico.util.struct.enum.IndicoEnum

Description of the personal data items that exist on every registration form

FIELD_DATA = [(<PersonalDataType.title: 5>, {u'input_type': u'single_choice', u'data': {u'item_type': u'dropdown', u'with_extra_slots': False, u'choices': [{u'is_enabled': True, 'caption': u'Mr.', u'is_billable': False, u'places_limit': 0, u'price': 0, 'id': u'89bddacb-f2bb-46f3-94ec-66b5c7051731'}, {u'is_enabled': True, 'caption': u'Ms.', u'is_billable': False, u'places_limit': 0, u'price': 0, 'id': u'aa9e418e-9c15-44d9-8297-712af8410a2f'}, {u'is_enabled': True, 'caption': u'Mrs.', u'is_billable': False, u'places_limit': 0, u'price': 0, 'id': u'0f058643-cec2-4130-beed-808fb38f4d98'}, {u'is_enabled': True, 'caption': u'Dr.', u'is_billable': False, u'places_limit': 0, u'price': 0, 'id': u'd8d25464-cc76-4311-8a98-460416636283'}, {u'is_enabled': True, 'caption': u'Prof.', u'is_billable': False, u'places_limit': 0, u'price': 0, 'id': u'fb06a056-4818-4042-b375-77cf7c52faf3'}]}, u'title': u'Title'}), (<PersonalDataType.first_name: 2>, {u'input_type': u'text', u'title': u'First Name'}), (<PersonalDataType.last_name: 3>, {u'input_type': u'text', u'title': u'Last Name'}), (<PersonalDataType.email: 1>, {u'input_type': u'email', u'title': u'Email Address'}), (<PersonalDataType.affiliation: 4>, {u'input_type': u'text', u'title': u'Affiliation'}), (<PersonalDataType.address: 6>, {u'is_enabled': False, u'input_type': u'textarea', u'position': 1000, u'title': u'Address'}), (<PersonalDataType.country: 8>, {u'is_enabled': False, u'input_type': u'country', u'position': 1001, u'title': u'Country'}), (<PersonalDataType.phone: 7>, {u'is_enabled': False, u'input_type': u'phone', u'position': 1002, u'title': u'Phone Number'}), (<PersonalDataType.position: 9>, {u'is_enabled': False, u'input_type': u'text', u'position': 1003, u'title': u'Position'})]
address = 6
affiliation = 4
column

The Registration column in which the value is stored in addition to the regular registration data entry.

country = 8
email = 1
first_name = 2
get_title()
is_required
last_name = 3
phone = 7
position = 9
title = 5
class indico.modules.events.registration.models.items.RegistrationFormItem(**kwargs)

Bases: flask_sqlalchemy.Model

Generic registration form item

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

children
current_data

The latest value of the field

current_data_id

The ID of the latest data

data

unversioned field data

data_versions

The list of all versions of the field data

description

Description of this field

id

The ID of the object

input_type

input type of this field

is_deleted

Whether field has been “deleted”

is_enabled

Whether the field is enabled

is_field
is_manager_only

if the section is only accessible to managers

is_required

determines if the field is mandatory

is_section
is_visible
parent_id

The ID of the parent form item

personal_data_type

The type of a personal data field

position
registration_form_id

The ID of the registration form

title

The title of this field

type

The type of the registration form item

view_data

Returns object with data that Angular can understand

class indico.modules.events.registration.models.items.RegistrationFormItemType

Bases: int, indico.util.struct.enum.IndicoEnum

field = 2
field_pd = 5
section = 1
section_pd = 4
text = 3
class indico.modules.events.registration.models.items.RegistrationFormPersonalDataSection(**kwargs)

Bases: indico.modules.events.registration.models.items.RegistrationFormSection

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

children
current_data
current_data_id
data
data_versions
description
id
input_type
is_deleted
is_enabled
is_manager_only
is_required
parent_id
personal_data_type
position
registration_form_id
title
type
view_data
class indico.modules.events.registration.models.items.RegistrationFormSection(**kwargs)

Bases: indico.modules.events.registration.models.items.RegistrationFormItem

Registration form section that can contain fields and text

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

active_fields
children
current_data
current_data_id
data
data_versions
description
fields
id
input_type
is_deleted
is_enabled
is_manager_only
is_required
locator
own_data
parent_id
personal_data_type
position
registration_form_id
title
type
view_data
class indico.modules.events.registration.models.items.RegistrationFormText(**kwargs)

Bases: indico.modules.events.registration.models.items.RegistrationFormItem

Text to be displayed in registration form sections

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

children
current_data
current_data_id
data
data_versions
description
id
input_type
is_deleted
is_enabled
is_manager_only
is_required
locator
parent_id
personal_data_type
position
registration_form_id
title
type
view_data

Utilities

indico.modules.events.registration.util.build_registration_api_data(registration)
indico.modules.events.registration.util.build_registrations_api_data(event)
indico.modules.events.registration.util.check_registration_email(regform, email, registration=None, management=False)

Checks whether an email address is suitable for registration.

Parameters:
  • regform – The registration form
  • email – The email address
  • registration – The existing registration (in case of modification)
  • management – If it’s a manager adding a new registration
indico.modules.events.registration.util.create_personal_data_fields(regform)

Creates the special section/fields for personal data.

indico.modules.events.registration.util.create_registration(regform, data, invitation=None, management=False, notify_user=True)
indico.modules.events.registration.util.generate_spreadsheet_from_registrations(registrations, regform_items, static_items)

Generates a spreadsheet data from a given registration list.

Parameters:
  • registrations – The list of registrations to include in the file
  • regform_items – The registration form items to be used as columns
  • static_items – Registration form information as extra columns
indico.modules.events.registration.util.generate_ticket_qr_code(registration)

Generate a Pillow Image with a QR Code encoding a check-in ticket.

Parameters:registration – corresponding Registration object
indico.modules.events.registration.util.get_event_regforms(event, user, with_registrations=False)

Get registration forms with information about user registrations.

Parameters:
  • event – the Event to get registration forms for
  • user – A User
  • with_registrations – Whether to return the user’s registration instead of just whether they have one
indico.modules.events.registration.util.get_event_section_data(regform, management=False, registration=None)
indico.modules.events.registration.util.get_events_registered(user, dt=None)

Gets the IDs of events where the user is registered.

Parameters:
  • user – A User
  • dt – Only include events taking place on/after that date
Returns:

A set of event ids

indico.modules.events.registration.util.get_published_registrations(event)

Get a list of published registrations for an event.

Parameters:event – the Event to get registrations for
Returns:list of Registration objects
indico.modules.events.registration.util.get_registrations_with_tickets(user, event)
indico.modules.events.registration.util.get_title_uuid(regform, title)

Convert a string title to its UUID value

If the title does not exist in the title PD field, it will be ignored and returned as None.

indico.modules.events.registration.util.make_registration_form(regform, management=False, registration=None)

Creates a WTForm based on registration form fields

indico.modules.events.registration.util.modify_registration(registration, data, management=False, notify_user=True)
indico.modules.events.registration.util.url_rule_to_angular(endpoint)

Converts a flask-style rule to angular style

Placeholders

class indico.modules.events.registration.placeholders.registrations.EventLinkPlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'Link to the event'
name = u'event_link'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.registrations.EventTitlePlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'The title of the event'
name = u'event_title'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.registrations.FieldPlaceholder

Bases: indico.util.placeholders.ParametrizedPlaceholder

advanced = True
description = None
classmethod iter_param_info(regform, registration)
name = u'field'
param_required = True
param_restricted = True
classmethod render(param, regform, registration)
class indico.modules.events.registration.placeholders.registrations.FirstNamePlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'First name of the person'
name = u'first_name'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.registrations.IDPlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'The ID of the registration'
name = u'id'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.registrations.LastNamePlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'Last name of the person'
name = u'last_name'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.registrations.LinkPlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'The link to the registration details'
name = u'link'
classmethod render(regform, registration)
class indico.modules.events.registration.placeholders.invitations.FirstNamePlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'First name of the person'
name = u'first_name'
classmethod render(invitation)
class indico.modules.events.registration.placeholders.invitations.InvitationLinkPlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'Link to accept/decline the invitation'
name = u'invitation_link'
classmethod render(invitation)
required = True
class indico.modules.events.registration.placeholders.invitations.LastNamePlaceholder

Bases: indico.util.placeholders.Placeholder

description = lu'Last name of the person'
name = u'last_name'
classmethod render(invitation)

Settings

class indico.modules.events.registration.settings.RegistrationSettingsProxy(module, defaults=None, strict=True, acls=None, converters=None)

Bases: indico.modules.events.settings.EventSettingsProxy

Store per-event registration settings

get_participant_list_columns(event, form=None)
get_participant_list_form_ids(event)
set_participant_list_columns(event, columns, form=None)
set_participant_list_form_ids(event, form_ids)

Statistics

class indico.modules.events.registration.stats.AccommodationStats(field)

Bases: indico.modules.events.registration.stats.FieldStats, indico.modules.events.registration.stats.StatsBase

class indico.modules.events.registration.stats.Cell

Bases: indico.modules.events.registration.stats.Cell

Hold data and type for a cell of a stats table

The table below indicates the valid types and expected data.

type data
str str – string value
progress (int, str) – a tuple with the progress (a value between 0 and 1) and a label
progress-stacked ([int], str) – a tuple with a list of progresses (values which must sum up to 1) and a label
currency float – numeric value
icon str – icon name from _icons.scss
default None – renders a default cell with an &mdash; (use Cell(type=’str’) for an empty cell)
Parameters:
  • type – str – The type of data in the cell
  • data – The data for the cell
  • colspan – int – HTML colspan value for the cell
  • classes – [str] – HTML classes to apply to the cell
  • qtip – str – content for qtip
class indico.modules.events.registration.stats.DataItem

Bases: indico.modules.events.registration.stats.DataItem

Holds the aggregation of some data, intended for stats tables as a aggregation from which to generate cells.

Parameters:
  • regs – int – number of registrant
  • attendance – int – number of people attending
  • capacity – int – maximum number of people allowed to attend (0 if unlimited)
  • billable – bool – whether the item is billable to the or not
  • cancelled – bool – whether the item is cancelled or not
  • price – str – the price of the item
  • fixed_price – bool – True if the price is per registrant, False if accompanying guests must pay as well.
  • paid – int – number of registrants who paid
  • paid_amount – float – amount already paid by registrants
  • unpaid – int – number of registrants who haven’t paid
  • unpaid_amount – float – amount not already paid by registrants
class indico.modules.events.registration.stats.FieldStats(field, **kwargs)

Bases: object

Holds stats for a registration form field

get_table()

Returns a table containing the stats for each item.

Returns:dict – A table with a list of head cells (key: ‘head’) and a list of rows (key: ‘rows’) where each row is a list of cells.
is_currency_shown
class indico.modules.events.registration.stats.OverviewStats(regform)

Bases: indico.modules.events.registration.stats.StatsBase

Generic stats for a registration form

class indico.modules.events.registration.stats.StatsBase(title, subtitle, type, **kwargs)

Bases: object

Base class for registration form statistics

Parameters:
  • title – str – the title for the stats box
  • subtitle – str – the subtitle for the stats box
  • type – str – the type used in Jinja to display the stats
is_currency_shown