Designer

Todo

Docstrings (module, models, utilities)

Models

class indico.modules.designer.models.images.DesignerImageFile(**kwargs)

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.

content_type

The MIME type of the file.

created_dt

The date/time when the file was uploaded.

property download_url
extension

The extension of the file.

filename

The name of the file.

id

The ID of the file

property locator
md5

An MD5 hash of the file.

Automatically assigned when save() is called.

size

The size of the file (in bytes).

Automatically assigned when save() is called.

storage_backend
storage_file_id
template
template_id

The designer template the image belongs to

version_of = None

Name of attribute (backref) that will be made to point to the versioned resource (leave as None if you don’t want versioning)

class indico.modules.designer.models.templates.DesignerTemplate(**kwargs)

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.

background_image
background_image_id
backside_template
backside_template_id
category
category_id
data
event
event_id
id
is_clonable
is_system_template
property is_ticket
locator()

Define 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.

owner
query: IndicoBaseQuery

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

title
type

Utilities

indico.modules.designer.util.get_all_templates(obj)

Get all templates usable by an event/category.

indico.modules.designer.util.get_badge_format(tpl)
indico.modules.designer.util.get_default_badge_on_category(category, only_inherited=False)
indico.modules.designer.util.get_default_ticket_on_category(category, only_inherited=False)
indico.modules.designer.util.get_image_placeholder_types()
indico.modules.designer.util.get_inherited_templates(obj)

Get all templates inherited by a given event/category.

indico.modules.designer.util.get_nested_placeholder_options()
indico.modules.designer.util.get_not_deletable_templates(obj)

Get all non-deletable templates for an event/category.

indico.modules.designer.util.get_placeholder_options()
class indico.modules.designer.pdf.DesignerPDFBase(template, config)
get_pdf()
class indico.modules.designer.pdf.TplData(width, height, items, background_position, width_cm, height_cm)

Create new instance of TplData(width, height, items, background_position, width_cm, height_cm)

background_position

Alias for field number 3

height

Alias for field number 1

height_cm

Alias for field number 5

items

Alias for field number 2

width

Alias for field number 0

width_cm

Alias for field number 4

Placeholders

class indico.modules.designer.placeholders.CategoryTitlePlaceholder
description = l'Category Title'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'category_title'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventDatesPlaceholder
description = l'Event Dates'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_dates'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventDescriptionPlaceholder
description = l'Event Description'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_description'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventLogoPlaceholder
description = l'Event Logo'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

is_image = True

Whether this placeholder is rendering an image

name = 'event_logo'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventOrgTextPlaceholder
description = l'Event Organizers'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_organizers'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventRoomPlaceholder
description = l'Event Room'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_room'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventSpeakersPlaceholder
description = l'Event Speakers/Chairs'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_speakers'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventTitlePlaceholder
description = l'Event Title'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_title'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.EventVenuePlaceholder
description = l'Event Venue'

A short description of the placeholder.

group = 'event'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'event_venue'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(event)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.FixedImagePlaceholder
description = l'Fixed Image'

A short description of the placeholder.

group = 'fixed'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

is_image = True

Whether this placeholder is rendering an image

name = 'fixed_image'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(item)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.FixedTextPlaceholder
description = l'Fixed Text'

A short description of the placeholder.

group = 'fixed'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

name = 'fixed'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(item)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.RegistrationAccompanyingPersonsAbbrevPlaceholder
description = l'Accompanying persons (abbrev.)'

A short description of the placeholder.

name = 'accompanying_persons_abbrev'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'last_name_first': False}
class indico.modules.designer.placeholders.RegistrationAccompanyingPersonsCountPlaceholder
description = l'Number of accompanying persons'

A short description of the placeholder.

name = 'num_accompanying_persons'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(registration)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.RegistrationAccompanyingPersonsPlaceholder
description = l'Accompanying persons'

A short description of the placeholder.

name = 'accompanying_persons'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'abbrev_first_name': False, 'last_name_first': False}
class indico.modules.designer.placeholders.RegistrationAddressPlaceholder
description = l'Address'

A short description of the placeholder.

field = 'address'
name = 'address'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationAffiliationPlaceholder
description = l'Institution'

A short description of the placeholder.

field = 'affiliation'
name = 'affiliation'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationAmountPlaceholder
description = l'Price (no currency)'

A short description of the placeholder.

name = 'amount'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(registration)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.RegistrationCountryPlaceholder
description = l'Country'

A short description of the placeholder.

field = 'country'
name = 'country'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationEmailPlaceholder
description = l'E-mail'

A short description of the placeholder.

field = 'email'
name = 'email'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationFirstNamePlaceholder
description = l'First Name'

A short description of the placeholder.

field = 'first_name'
name = 'first_name'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationFriendlyIDPlaceholder
description = l'Registration ID'

A short description of the placeholder.

field = 'friendly_id'
name = 'registration_friendly_id'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholder
description = l'Full Name (no title)'

A short description of the placeholder.

name = 'full_name_no_title'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholderB
description = l'Full Name B (no title)'

A short description of the placeholder.

name = 'full_name_b_no_title'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'last_name_first': False}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholderC
description = l'Full Name C (no title)'

A short description of the placeholder.

name = 'full_name_no_title_c'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'last_name_upper': True}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholderD
description = l'Full Name D (abbrev., no title)'

A short description of the placeholder.

name = 'full_name_no_title_d'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'abbrev_first_name': True, 'last_name_upper': True}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholder
description = l'Full Name'

A short description of the placeholder.

name = 'full_name'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {}
with_title = True
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholderB
description = l'Full Name B'

A short description of the placeholder.

name = 'full_name_b'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'last_name_first': False}
with_title = True
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholderC
description = l'Full Name C'

A short description of the placeholder.

name = 'full_name_c'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'last_name_first': False, 'last_name_upper': True}
with_title = True
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholderD
description = l'Full Name D (abbrev.)'

A short description of the placeholder.

name = 'full_name_d'

The name of the placeholder. Must be unique within the context where the placeholder is used

name_options = {'abbrev_first_name': True, 'last_name_first': False, 'last_name_upper': True}
with_title = True
class indico.modules.designer.placeholders.RegistrationLastNamePlaceholder
description = l'Last Name'

A short description of the placeholder.

field = 'last_name'
name = 'last_name'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationPhonePlaceholder
description = l'Phone'

A short description of the placeholder.

field = 'phone'
name = 'phone'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationPositionPlaceholder
description = l'Position'

A short description of the placeholder.

field = 'position'
name = 'position'

The name of the placeholder. Must be unique within the context where the placeholder is used

class indico.modules.designer.placeholders.RegistrationPricePlaceholder
description = l'Price (with currency)'

A short description of the placeholder.

name = 'price'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(registration)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.RegistrationTicketQRPlaceholder
description = l'Ticket QR Code'

A short description of the placeholder.

group = 'registrant'

The group of the placeholder. Must be a valid key from GROUP_TITLES.

is_image = True

Whether this placeholder is rendering an image

is_ticket = True

Whether a template containing this placeholder is considered a ticket

name = 'ticket_qr_code'

The name of the placeholder. Must be unique within the context where the placeholder is used

classmethod render(registration)

Convert the placeholder to a string.

When a placeholder contains HTML that should not be escaped, the returned value should be returned as a markupsafe.Markup instance instead of a plain string.

Subclasses are encouraged to explicitly specify the arguments they expect instead of using **kwargs.

Parameters:

kwargs – arguments specific to the placeholder’s context

class indico.modules.designer.placeholders.RegistrationTitlePlaceholder
description = l'Title'

A short description of the placeholder.

field = 'title'
name = 'title'

The name of the placeholder. Must be unique within the context where the placeholder is used