org.models.ticket

Classes

OrgTicketMixin

Adds additional methods to the ticket, needed by the organisations

FormSubmissionTicket

Adds additional methods to the ticket, needed by the organisations

ReservationTicket

Adds additional methods to the ticket, needed by the organisations

EventSubmissionTicket

Adds additional methods to the ticket, needed by the organisations

DirectoryEntryTicket

Adds additional methods to the ticket, needed by the organisations

FormSubmissionHandler

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

ReservationHandler

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

EventSubmissionHandler

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

DirectoryEntryHandler

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

ChatTicket

Adds additional methods to the ticket, needed by the organisations

ChatHandler

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

Functions

ticket_submitter(→ str | None)

Module Contents

org.models.ticket.ticket_submitter(ticket: onegov.ticket.Ticket) str | None[source]
class org.models.ticket.OrgTicketMixin[source]

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

number: sqlalchemy.Column[str][source]
reference(request: onegov.org.request.OrgRequest) str[source]

Returns the reference which should be used wherever we talk about a ticket, but do not show it (say in an e-mail subject).

This reference should not be changed so it stays consistent.

If you want, you can override the content of the reference group, shown in brackets (see reference_group()).

reference_group(request: onegov.org.request.OrgRequest) str[source]
property extra_localized_text: str[source]
property es_tags: list[str] | None[source]
class org.models.ticket.FormSubmissionTicket[source]

Bases: 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 = 'submission_tickets'[source]

Returns the unique type name of the model.

class org.models.ticket.ReservationTicket[source]

Bases: 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 = 'reservation_tickets'[source]

Returns the unique type name of the model.

class org.models.ticket.EventSubmissionTicket[source]

Bases: 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 = 'event_tickets'[source]

Returns the unique type name of the model.

handler: EventSubmissionHandler[source]

Returns an instance of the handler associated with this ticket.

reference_group(request: onegov.org.request.OrgRequest) str[source]
class org.models.ticket.DirectoryEntryTicket[source]

Bases: 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 = 'directory_tickets'[source]

Returns the unique type name of the model.

class org.models.ticket.FormSubmissionHandler(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.).

id: uuid.UUID[source]
handler_title[source]
code_title[source]
property collection: onegov.form.FormSubmissionCollection[source]
property submission: FormSubmission | None[source]
property form: onegov.form.Form[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: 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 payment: Payment | None[source]

An optional link to a onegov.pay payment record.

property extra_data: list[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).

get_summary(request: onegov.org.request.OrgRequest) 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.

class org.models.ticket.ReservationHandler(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.).

id: uuid.UUID[source]
handler_title[source]
code_title[source]
property resource: onegov.reservation.Resource | None[source]
reservations_query() Query[Reservation][source]
property reservations: tuple[onegov.reservation.Reservation, Ellipsis][source]
property has_future_reservation: bool[source]
property most_future_reservation: onegov.reservation.Reservation | None[source]
property submission: FormSubmission | None[source]
property payment: Payment | None[source]

An optional link to a onegov.pay payment record.

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 extra_data: list[str][source]

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

property email: str[source]

Returns the email address behind the ticket request.

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

prepare_delete_ticket() None[source]

The handler knows best what to do when a ticket is called for deletion.

property ticket_deletable: bool[source]
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.

get_reservation_title(reservation: onegov.reservation.Reservation) str[source]
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 | None[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.

classmethod handle_extra_parameters(session: sqlalchemy.orm.Session, query: onegov.ticket.handler._Q, extra_parameters: dict[str, Any]) onegov.ticket.handler._Q[source]

Takes a dictionary of extra parameters and uses it to optionally modifiy the query used for the collection.

Use this to add handler-defined custom filters with extra query parameters. Only called if the collection is already limited to the given handler. If all handlers are shown in the collection, this method is not called.

If no extra paramaters were given, this method is not called.

Returns the modified or unmodified query.

get_summary(request: onegov.org.request.OrgRequest) 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.

class org.models.ticket.EventSubmissionHandler(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.).

id: uuid.UUID[source]
handler_title[source]
code_title[source]
property collection: onegov.event.EventCollection[source]
property event: Event | 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 source: str | None[source]
property import_user: str | None[source]
property email: str | None[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 extra_data: list[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]
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.

get_summary(request: onegov.org.request.OrgRequest) 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.

class org.models.ticket.DirectoryEntryHandler(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.).

id: uuid.UUID[source]
handler_title[source]
code_title[source]
property collection: onegov.form.FormSubmissionCollection[source]
property submission: FormSubmission | None[source]
property form: Form | None[source]
property directory: onegov.directory.Directory | None[source]
property entry: onegov.directory.DirectoryEntry | 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 submitter_name: str | None[source]

Returns the name of the submitter

property submitter_phone: str | None[source]

Returns the phone of the submitter

property submitter_address: str | None[source]

Returns the address of the submitter

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: 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 payment: Payment | None[source]

An optional link to a onegov.pay payment record.

property state: str | None[source]
property extra_data: list[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 kind: str[source]
get_summary(request: onegov.org.request.OrgRequest) 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.

class org.models.ticket.ChatTicket[source]

Bases: 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 = 'chat_tickets'[source]

Returns the unique type name of the model.

reference_group(request: onegov.org.request.OrgRequest) str[source]
class org.models.ticket.ChatHandler(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.chat.collections.ChatCollection[source]
property chat: Chat | 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 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: 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 | None[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 email: str[source]

Returns the email address behind the ticket request.

get_summary(request: onegov.org.request.OrgRequest) 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.