feriennet.models.activity

Classes

VacationActivity

Describes an activity that is made available to participants on

ActivityTicket

Adds additional methods to the ticket, needed by the organisations

VacationActivityHandler

Defines a generic handler, responsible for a subset of the tickets.

Module Contents

class feriennet.models.activity.VacationActivity[source]

Bases: onegov.activity.Activity, onegov.org.models.extensions.CoordinatesExtension, onegov.search.SearchableContent

Describes an activity that is made available to participants on certain occasions (i.e. dates).

The activity describes the what’s going on, the occasion describes when and with whom.

__mapper_args__[source]
es_type_name = 'vacation'[source]

Returns the unique type name of the model.

es_properties[source]

Returns the type mapping of this model. Each property in the mapping will be read from the model instance.

The returned object needs to be a dict or an object that provides a to_dict method.

Internally, onegov.search stores differing languages in different indices. It does this automatically through langauge detection, or by manually specifying a language.

Note that objects with multiple languages are not supported (each object is supposed to have exactly one language).

Onegov.search will automatically insert the right analyzer for types like these.

There’s currently only limited support for properties here, namely objects and nested mappings do not work! This is going to be added in the future though.

property es_public: bool[source]

Returns True if the model is available to be found by the public. If false, only editors/admins will see this object in the search results.

property es_skip: bool[source]

Returns True if the indexing of this specific model instance should be skipped.

property organiser: list[str][source]
ordered_tags(request: onegov.feriennet.request.FeriennetRequest, durations: int | None = None) list[str][source]
class feriennet.models.activity.ActivityTicket[source]

Bases: onegov.org.models.ticket.OrgTicketMixin, onegov.ticket.Ticket

Adds additional methods to the ticket, needed by the organisations implementation of it. Strictly limited to things that do not belong into onegov.ticket.

__mapper_args__[source]
es_type_name = 'activity_tickets'[source]

Returns the unique type name of the model.

reference_group(request: onegov.feriennet.request.FeriennetRequest) str[source]
class feriennet.models.activity.VacationActivityHandler(ticket: onegov.ticket.model.Ticket, handler_id: UUID | str, handler_data: dict[str, Any])[source]

Bases: onegov.ticket.Handler

Defines a generic handler, responsible for a subset of the tickets.

onegov.ticket is meant to be a rather generic bucket of tickets, to which varying modules submit tickets with varying content and different actionables.

Each module wanting to submit tickets needs to implement a handler with a unique id and a unique short code. The short code is added in front of the ticket number.

Tickets submitted to the database are shown in a list, without handler involvement. When a ticket is displayed, the handler is called with whatever data the handler supplied during ticket submission.

The handler then uses the handler data to access whatever data it needs to display a summary as well as links to certain actions (possibly a link to the original item, links that change the state of the ticket as well as the data associated with the handler, etc.).

handler_title[source]
code_title[source]
property collection: onegov.activity.PublicationRequestCollection[source]
property activity: onegov.activity.Activity | None[source]
property publication_request: PublicationRequest | None[source]
property deleted: bool[source]

Returns true if the underlying model was deleted. It is best to never let that happen, as we want tickets to stay around forever.

However, this can make sense in certain scenarios. Note that if you do delete your underlying model, make sure to call onegov.ticket.models.Ticket.create_snapshot() beforehand!

property email: str[source]

Returns the email address behind the ticket request.

property title: str[source]

Returns the title of the ticket. If this title may change over time, the handler must call self.refresh() when there’s a change.

property subtitle: str | None[source]

Returns the subtitle of the ticket. If this title may change over time, the handler must call self.refresh() when there’s a change.

property group: str[source]

Returns the group of the ticket. If this group may change over time, the handler must call self.refresh() when there’s a change.

property extra_data: Sequence[str][source]

An array of string values which are indexed in elasticsearch when the ticket is stored there.

property undecided: bool[source]

Returns true if there has been no decision about the subject of this handler.

For example, if a reservation ticket has been accepted, but the reservation has been neither confirmed nor cancelled, the ticket can be seen as undecided.

This is an optional flag that may be implemented by handlers. If a ticket is undecided, the UI might show a special icon and it might warn the user if he closes the ticket without making a decision.

By default, the ticket is assumed to be decided for backwards compatibility and for tickets where this does not make sense (a simple form submission may not have any way of knowing if there has been a decision or not).

property ticket_deletable: bool[source]
get_summary(request: onegov.feriennet.request.FeriennetRequest) markupsafe.Markup[source]

Returns the summary of the current ticket as a html string.

Returns the links associated with the current ticket in the following format:

[
    ('Link Title', 'http://link'),
    ('Link Title 2', 'http://link2'),
]

If the links are not tuples, but callables, they will be called with the request which should return the rendered link.