Designer

Todo

Docstrings (module, models, utilities)

Models

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

Bases: indico.core.storage.models.StoredFileMixin, sqlalchemy.orm.decl_api.Model

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.

download_url
extension

The extension of the file.

filename

The name of the file.

id

The ID of the file

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
class indico.modules.designer.models.templates.DesignerTemplate(**kwargs)

Bases: sqlalchemy.orm.decl_api.Model

background_image
background_image_id
backside_template
backside_template_id
category
category_id
data
event
event_id
id
is_clonable
is_system_template
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
title
type

Utilities

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

Get all templates usable by an event/category.

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)

Bases: object

get_pdf()
class indico.modules.designer.pdf.TplData(width, height, items, background_position, width_cm, height_cm)

Bases: tuple

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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Dates'
group = 'event'
name = 'event_dates'
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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Description'
group = 'event'
name = 'event_description'
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.RegistrationFullNamePlaceholder

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

description = l'Full Name'
name = 'full_name'
name_options = {}
with_title = True
class indico.modules.designer.placeholders.EventOrgTextPlaceholder

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Organizers'
group = 'event'
name = 'event_organizers'
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.RegistrationFullNameNoTitlePlaceholder

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

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

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

description = l'Full Name B'
name = 'full_name_b'
name_options = {'last_name_first': False}
with_title = True
class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholderB

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

description = l'Full Name B (no title)'
name = 'full_name_b_no_title'
name_options = {'last_name_first': False}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholderC

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

description = l'Full Name C'
name = 'full_name_c'
name_options = {'last_name_first': False, 'last_name_upper': True}
with_title = True
class indico.modules.designer.placeholders.RegistrationFullNameNoTitlePlaceholderC

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

description = l'Full Name C (no title)'
name = 'full_name_no_title_c'
name_options = {'last_name_upper': True}
with_title = False
class indico.modules.designer.placeholders.RegistrationFullNamePlaceholderD

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

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

Bases: indico.modules.designer.placeholders.FullNamePlaceholderBase

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

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Title'
field = 'title'
name = 'title'
class indico.modules.designer.placeholders.RegistrationFirstNamePlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'First Name'
field = 'first_name'
name = 'first_name'
class indico.modules.designer.placeholders.RegistrationLastNamePlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'Last Name'
field = 'last_name'
name = 'last_name'
class indico.modules.designer.placeholders.RegistrationTicketQRPlaceholder

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Ticket QR Code'
group = 'registrant'
is_image = True
is_ticket = True
name = 'ticket_qr_code'
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.RegistrationEmailPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'E-mail'
field = 'email'
name = 'email'
class indico.modules.designer.placeholders.RegistrationAmountPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'Price (no currency)'
name = 'amount'
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.RegistrationPricePlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'Price (with currency)'
name = 'price'
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.RegistrationFriendlyIDPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPlaceholder

description = l'Registration ID'
field = 'friendly_id'
name = 'registration_friendly_id'
class indico.modules.designer.placeholders.RegistrationAffiliationPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Institution'
field = 'affiliation'
name = 'affiliation'
class indico.modules.designer.placeholders.RegistrationPositionPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Position'
field = 'position'
name = 'position'
class indico.modules.designer.placeholders.RegistrationAddressPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Address'
field = 'address'
name = 'address'
class indico.modules.designer.placeholders.RegistrationCountryPlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Country'
field = 'country'
name = 'country'
class indico.modules.designer.placeholders.RegistrationPhonePlaceholder

Bases: indico.modules.designer.placeholders.RegistrationPDPlaceholder

description = l'Phone'
field = 'phone'
name = 'phone'
class indico.modules.designer.placeholders.EventTitlePlaceholder

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Title'
group = 'event'
name = 'event_title'
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.CategoryTitlePlaceholder

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Category Title'
group = 'event'
name = 'category_title'
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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Room'
group = 'event'
name = 'event_room'
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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Venue'
group = 'event'
name = 'event_venue'
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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Speakers/Chairs'
group = 'event'
name = 'event_speakers'
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

Bases: indico.modules.designer.placeholders.DesignerPlaceholder

description = l'Event Logo'
group = 'event'
is_image = True
name = 'event_logo'
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