Defines a ticket.


Defines a custom ticket permission.

Module Contents

class ticket.model.Ticket[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin, onegov.search.ORMSearchable

Defines a ticket.

__tablename__ = 'tickets'[source]
id: Column[uuid.UUID][source]
number: Column[str][source]
title: Column[str][source]
subtitle: Column[str | None][source]
group: Column[str][source]
handler_code: Column[str][source]
handler_id: Column[str][source]
handler_data: Column[dict[str, Any]][source]
snapshot: Column[dict[str, Any]][source]
last_state_change: Column[datetime | None][source]
reaction_time: Column[int | None][source]
process_time: Column[int | None][source]
muted: Column[bool][source]
state: Column[TicketState][source]
user_id: Column[uuid.UUID | None][source]
user: relationship[User | None][source]
es_public = False[source]
property extra_localized_text: str | None[source]

Maybe used by child-classes to return localized extra data that should be indexed as well.

property es_suggestion: list[str][source]

Returns suggest-as-you-type value of the document. The field used for this property should also be indexed, or the suggestion will lead to nowhere.

If a single string is returned, the completion input equals the completion output. (My Title -> My Title)

If an array of strings is returned, all values are possible inputs and the first value is the output. (My Title/Title My -> My Title)

property ticket_email: str | None[source]
property ticket_data: Sequence[str] | None[source]
redact_data() None[source]

Redact sensitive information from the ticket to protect personal data.

In scenarios where complete deletion is not feasible, this method serves as an alternative by masking sensitive information, like addresses, phone numbers in the form submission.

property handler: onegov.ticket.handler.Handler[source]

Returns an instance of the handler associated with this ticket.

property current_process_time: int | None[source]
accept_ticket(user: onegov.user.User) None[source]
close_ticket() None[source]
reopen_ticket(user: onegov.user.User) None[source]
archive_ticket() None[source]
unarchive_ticket(user: onegov.user.User) None[source]
create_snapshot(request: onegov.core.request.CoreRequest) None[source]

Takes the current handler and stores the output of the summary as a snapshot.

TODO: This doesn’t support multiple langauges at this point. The language of the user creating the snapshot will be what’s stored.

In the future we might change this by iterating over all supported languages and creating the summary for each language.

class ticket.model.TicketPermission[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin

Defines a custom ticket permission.

If a ticket permission is defined for ticket handler (and optionally a group), a user has to be in the given user group to access these tickets.

__tablename__ = 'ticket_permissions'[source]
id: Column[uuid.UUID][source]
user_group_id: Column[uuid.UUID][source]
user_group: relationship[UserGroup][source]
handler_code: Column[str][source]
group: Column[str | None][source]