AKModel.models module

class AKModel.models.Event(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_event

An event supplies the frame for all Aks.

Parameters:
  • id (AutoField) – Primary key: ID

  • name (CharField) – Name. Name or iteration of the event

  • slug (SlugField) – Short Form. Short name of letters/numbers/dots/dashes/underscores used in URLs.

  • place (CharField) – Place. City etc. the event takes place in

  • timezone (TimeZoneField) – Time Zone. Time Zone where this event takes place in

  • start (DateTimeField) – Start. Time the event begins

  • end (DateTimeField) – End. Time the event ends

  • reso_deadline (DateTimeField) – Resolution Deadline. When should AKs with intention to submit a resolution be done?

  • interest_start (DateTimeField) – Interest Window Start. Opening time for expression of interest. When left blank, no interest indication will be possible.

  • interest_end (DateTimeField) – Interest Window End. Closing time for expression of interest.

  • public (BooleanField) – Public event. Show this event on overview page.

  • active (BooleanField) – Active State. Marks currently active events

  • plan_hidden (BooleanField) – Plan Hidden. Hides plan for non-staff users

  • plan_published_at (DateTimeField) – Plan published at. Timestamp at which the plan was published

  • base_url (URLField) – Base URL. Prefix for wiki link construction

  • wiki_export_template_name (CharField) – Wiki Export Template Name

  • default_slot (DecimalField) – Default Slot Length. Default length in hours that is assumed for AKs in this event.

  • contact_email (EmailField) – Contact email address. An email address that is displayed on every page and can be used for all kinds of questions

Reverse relationships:

Parameters:
  • akowner (Reverse ForeignKey from AKOwner) – All AK Owners of this Event (related name of event)

  • akcategory (Reverse ForeignKey from AKCategory) – All AK Categories of this Event (related name of event)

  • aktrack (Reverse ForeignKey from AKTrack) – All AK Tracks of this Event (related name of event)

  • akrequirement (Reverse ForeignKey from AKRequirement) – All AK Requirements of this Event (related name of event)

  • ak (Reverse ForeignKey from AK) – All AKs of this Event (related name of event)

  • room (Reverse ForeignKey from Room) – All Rooms of this Event (related name of event)

  • akslot (Reverse ForeignKey from AKSlot) – All AK Slots of this Event (related name of event)

  • akorgamessage (Reverse ForeignKey from AKOrgaMessage) – All AK Orga Messages of this Event (related name of event)

  • constraintviolation (Reverse ForeignKey from ConstraintViolation) – All Constraint Violations of this Event (related name of event)

  • defaultslot (Reverse ForeignKey from DefaultSlot) – All Default Slots of this Event (related name of event)

  • availabilities (Reverse ForeignKey from Availability) – All availabilities of this Event (related name of event)

  • dashboardbutton (Reverse ForeignKey from DashboardButton) – All Dashboard Buttons of this Event (related name of event)

static get_by_slug(slug)[source]

Get event by its slug

Parameters:

slug – slug of the event

Returns:

event identified by the slug

Return type:

Event

static get_next_active()[source]

Get first active event taking place :return: matching event (if any) or None :rtype: Event

get_categories_with_aks(wishes_seperately=False, filter_func=<function Event.<lambda>>, hide_empty_categories=False)[source]

Get AKCategories as well as a list of AKs belonging to the category for this event

Parameters:
  • wishes_seperately (bool) – Return wishes as individual list.

  • filter_func ((AK)->bool) – Optional filter predicate, only include AK in list if filter returns True

Returns:

list of category-AK-list-tuples, optionally the additional list of AK wishes

Return type:

list[(AKCategory, list[AK])] [, list[AK]]

get_unscheduled_wish_slots()[source]

Get all slots of wishes that are currently not scheduled :return: queryset of theses slots :rtype: QuerySet[AKSlot]

get_aks_without_availabilities()[source]

Gt all AKs that don’t have any availability at all

Returns:

generator over these AKs

Return type:

Generator[AK]

class AKModel.models.AKOwner(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_akowner

An AKOwner describes the person organizing/holding an AK.

Parameters:
  • id (AutoField) – Primary key: ID

  • name (CharField) – Nickname. Name to identify an AK owner by

  • slug (SlugField) – Slug. Slug for URL generation

  • institution (CharField) – Institution. Uni etc.

  • link (URLField) – Web Link. Link to Homepage

Relationship fields:

Parameters:

event (ForeignKey to Event) – Event. Associated event (related name: akowner)

Reverse relationships:

Parameters:
  • ak (Reverse ManyToManyField from AK) – All AKs of this AK Owner (related name of owners)

  • constraintviolation (Reverse ForeignKey from ConstraintViolation) – All Constraint Violations of this AK Owner (related name of ak_owner)

  • availabilities (Reverse ForeignKey from Availability) – All availabilities of this AK Owner (related name of person)

static get_by_slug(event, slug)[source]

Get owner by slug Will be identified by the combination of event slug and owner slug which is unique

Parameters:
  • event – event

  • slug – slug of the owner

Returns:

owner identified by slugs

Return type:

AKOwner

class AKModel.models.AKCategory(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_akcategory

An AKCategory describes the characteristics of an AK, e.g. content vs. recreational.

Parameters:
  • id (AutoField) – Primary key: ID

  • name (CharField) – Name. Name of the AK Category

  • color (CharField) – Color. Color for displaying

  • description (TextField) – Description. Short description of this AK Category

  • present_by_default (BooleanField) – Present by default. Present AKs of this category by default if AK owner did not specify whether this AK should be presented?

Relationship fields:

Parameters:

event (ForeignKey to Event) – Event. Associated event (related name: akcategory)

Reverse relationships:

Parameters:
  • ak (Reverse ForeignKey from AK) – All AKs of this AK Category (related name of category)

  • constraintviolation (Reverse ForeignKey from ConstraintViolation) – All Constraint Violations of this AK Category (related name of category)

  • defaultslot (Reverse ManyToManyField from DefaultSlot) – All Default Slots of this AK Category (related name of primary_categories)

  • availabilities (Reverse ForeignKey from Availability) – All availabilities of this AK Category (related name of ak_category)

class AKModel.models.AKTrack(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_aktrack

An AKTrack describes a set of semantically related AKs.

Parameters:

Relationship fields:

Parameters:

event (ForeignKey to Event) – Event. Associated event (related name: aktrack)

Reverse relationships:

Parameters:

ak (Reverse ForeignKey from AK) – All AKs of this AK Track (related name of track)

aks_with_category()[source]

Get all AKs that belong to this track with category already joined to prevent additional SQL queries :return: queryset over the AKs :rtype: QuerySet[AK]

class AKModel.models.AKRequirement(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_akrequirement

An AKRequirement describes something needed to hold an AK, e.g. infrastructure.

Parameters:

Relationship fields:

Parameters:

event (ForeignKey to Event) – Event. Associated event (related name: akrequirement)

Reverse relationships:

Parameters:
  • ak (Reverse ManyToManyField from AK) – All AKs of this AK Requirement (related name of requirements)

  • room (Reverse ManyToManyField from Room) – All Rooms of this AK Requirement (related name of properties)

  • constraintviolation (Reverse ForeignKey from ConstraintViolation) – All Constraint Violations of this AK Requirement (related name of requirement)

class AKModel.models.AK(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_ak

An AK is a slot-based activity to be scheduled during an event.

Parameters:
  • id (AutoField) – Primary key: ID

  • name (CharField) – Name. Name of the AK

  • short_name (CharField) – Short Name. Name displayed in the schedule

  • description (TextField) – Description. Description of the AK

  • link (URLField) – Web Link. Link to wiki page

  • protocol_link (URLField) – Protocol Link. Link to protocol

  • reso (BooleanField) – Resolution Intention. Intends to submit a resolution

  • present (BooleanField) – Present this AK. Present results of this AK

  • notes (TextField) – Organizational Notes. Notes to organizers. These are public. For private notes, please use the button for private messages on the detail page of this AK (after creation/editing).

  • interest (IntegerField) – Interest. Expected number of people

  • interest_counter (IntegerField) – Interest Counter. People who have indicated interest online

  • include_in_export (BooleanField) – Export?. Include AK in wiki export?

Relationship fields:

Parameters:
  • category (ForeignKey to AKCategory) – Category. Category of the AK (related name: ak)

  • track (ForeignKey to AKTrack) – Track. Track the AK belongs to (related name: ak)

  • event (ForeignKey to Event) – Event. Associated event (related name: ak)

  • owners (ManyToManyField to AKOwner) – Owners. Those organizing the AK (related name: ak)

  • requirements (ManyToManyField to AKRequirement) – Requirements. AK’s Requirements (related name: ak)

  • conflicts (ManyToManyField to AK) – Conflicting AKs. AKs that conflict and thus must not take place at the same time (related name: conflict)

  • prerequisites (ManyToManyField to AK) – Prerequisite AKs. AKs that should precede this AK in the schedule (related name: ak)

Reverse relationships:

Parameters:
property details

Generate a detailed string representation, e.g., for usage in scheduling :return: string representation of that AK with all details :rtype: str

property owners_list

Get a list of stringified representations of all owners

Returns:

list of owners

Return type:

List[str]

property durations_list

Get a list of stringified representations of all durations of associated slots

Returns:

list of durations

Return type:

List[str]

property wish

Is the AK a wish? :return: true if wish, false if not :rtype: bool

increment_interest()[source]

Increment the interest counter for this AK by one without tracking that change to prevent an unreadable and large history

property edit_url

Get edit URL for this AK Will link to frontend if AKSubmission is active, otherwise to the edit view for this object in admin interface

Returns:

URL

Return type:

str

property detail_url

Get detail URL for this AK Will link to frontend if AKSubmission is active, otherwise to the edit view for this object in admin interface

Returns:

URL

Return type:

str

save_without_historical_record(*args, **kwargs)

Save model without saving a historical record

Make sure you know what you’re doing before you use this method.

class AKModel.models.Room(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_room

A room describes where an AK can be held.

Parameters:
  • id (AutoField) – Primary key: ID

  • name (CharField) – Name. Name or number of the room

  • location (CharField) – Location. Name or number of the location

  • capacity (IntegerField) – Capacity. Maximum number of people (-1 for unlimited).

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
property title

Get title of a room, which consists of location and name if location is set, otherwise only the name

Returns:

title

Return type:

str

class AKModel.models.AKSlot(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_akslot

An AK Mapping matches an AK to a room during a certain time.

Parameters:

Relationship fields:

Parameters:
  • ak (ForeignKey to AK) – AK. AK being mapped (related name: akslot)

  • room (ForeignKey to Room) – Room. Room the AK will take place in (related name: akslot)

  • event (ForeignKey to Event) – Event. Associated event (related name: akslot)

Reverse relationships:

Parameters:

constraintviolation (Reverse ManyToManyField from ConstraintViolation) – All Constraint Violations of this AK Slot (related name of ak_slots)

property duration_simplified

Display duration of slot in format hours:minutes, e.g. 1.5 -> “1:30”

property start_simplified

Display start time of slot in format weekday + time, e.g. “Fri 14:00”

property time_simplified

Display start and end time of slot in format weekday + time, e.g. “Fri 14:00 - 15:30” or “Fri 22:00 - Sat 02:00”

property end

Retrieve end time of the AK slot

property seconds_since_last_update

Return minutes since last update :return: minutes since last update :rtype: float

overlaps(other: AKSlot)[source]

Check wether two slots overlap

Parameters:

other – second slot to compare with

Returns:

true if they overlap, false if not:

Return type:

bool

class AKModel.models.AKOrgaMessage(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_akorgamessage

Model representing confidential messages to the organizers/scheduling people, belonging to a certain AK

Parameters:
  • id (AutoField) – Primary key: ID

  • text (TextField) – Message text. Message to the organizers. This is not publicly visible.

  • timestamp (DateTimeField) – Timestamp

  • resolved (BooleanField) – Resolved. This message has been resolved (no further action needed)

Relationship fields:

Parameters:
  • ak (ForeignKey to AK) – AK. AK this message belongs to (related name: akorgamessage)

  • event (ForeignKey to Event) – Event. Associated event (related name: akorgamessage)

class AKModel.models.ConstraintViolation(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_constraintviolation

Model to represent any kind of constraint violation

Can have two different severities: violation and warning The list of possible types is defined in ViolationType Depending on the type, different fields (references to other models) will be filled. Each violation should always be related to an event and at least on other instance of a causing entity

Parameters:
  • id (AutoField) – Primary key: ID

  • type (CharField) – Type. Type of violation, i.e. what kind of constraint was violated

  • level (PositiveSmallIntegerField) – Level. Severity level of the violation

  • comment (TextField) – Comment. Comment or further details for this violation

  • timestamp (DateTimeField) – Timestamp. Time of creation

  • manually_resolved (BooleanField) – Manually Resolved. Mark this violation manually as resolved

Relationship fields:

Parameters:
  • event (ForeignKey to Event) – Event. Associated event (related name: constraintviolation)

  • ak_owner (ForeignKey to AKOwner) – AK Owner. AK Owner belonging to this constraint (related name: constraintviolation)

  • room (ForeignKey to Room) – Room. Room belonging to this constraint (related name: constraintviolation)

  • requirement (ForeignKey to AKRequirement) – AK Requirement. AK Requirement belonging to this constraint (related name: constraintviolation)

  • category (ForeignKey to AKCategory) – AK Category. AK Category belonging to this constraint (related name: constraintviolation)

  • aks (ManyToManyField to AK) – AKs. AK(s) belonging to this constraint (related name: constraintviolation)

  • ak_slots (ManyToManyField to AKSlot) – AK Slots. AK Slot(s) belonging to this constraint (related name: constraintviolation)

class ViolationType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: TextChoices

Possible types of violations with their text representation

class ViolationLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntegerChoices

Possible severities/levels of a CV

__init__(*args, **kwargs)[source]
get_details()[source]

Get details of this constraint (all fields connected to it) :return: string of details :rtype: str

property details

Property: Details

property edit_url: str

Property: Edit URL for this CV

property level_display: str

Property: Severity as string

property type_display: str

Property: Type as string

property timestamp_display: str

Property: Creation timestamp as string

matches(other)[source]

Check whether one constraint violation instance matches another, this means has the same type, room, requirement, owner, category as well as the same lists of aks and ak slots. PK, timestamp, comments and manual resolving are ignored.

Parameters:

other (ConstraintViolation) – second instance to compare to

Returns:

true if both instances are similar in the way described, false if not

Return type:

bool

class AKModel.models.DefaultSlot(*args, **kwargs)[source]

Bases: Model

Database table: AKModel_defaultslot

Model representing a default slot, i.e., a prefered slot to use for typical AKs in the schedule to guarantee enough breaks etc.

Parameters:

Relationship fields:

Parameters:
  • event (ForeignKey to Event) – Event. Associated event (related name: defaultslot)

  • primary_categories (ManyToManyField to AKCategory) – Primary categories. Categories that should be assigned to this slot primarily (related name: defaultslot)

property start_simplified: str

Property: Simplified version of the start timetstamp (weekday, hour, minute) as string

property start_iso: str

Property: Start timestamp as ISO timestamp for usage in calendar views

property end_simplified: str

Property: Simplified version of the end timetstamp (weekday, hour, minute) as string

property end_iso: str

Property: End timestamp as ISO timestamp for usage in calendar views

class AKModel.models.HistoricalAK(id, name, short_name, description, link, protocol_link, reso, present, notes, interest, category, track, event, history_id, history_date, history_change_reason, history_type, history_user)

Bases: HistoricalChanges, Model

Database table: AKModel_historicalak

Parameters:
  • id (IntegerField) – ID

  • name (CharField) – Name. Name of the AK

  • short_name (CharField) – Short Name. Name displayed in the schedule

  • description (TextField) – Description. Description of the AK

  • link (URLField) – Web Link. Link to wiki page

  • protocol_link (URLField) – Protocol Link. Link to protocol

  • reso (BooleanField) – Resolution Intention. Intends to submit a resolution

  • present (BooleanField) – Present this AK. Present results of this AK

  • notes (TextField) – Organizational Notes. Notes to organizers. These are public. For private notes, please use the button for private messages on the detail page of this AK (after creation/editing).

  • interest (IntegerField) – Interest. Expected number of people

  • history_id (AutoField) – Primary key: History id

  • history_date (DateTimeField) – History date

  • history_change_reason (CharField) – History change reason

  • history_type (CharField) – History type

Relationship fields:

Parameters:
static get_default_history_user(instance)

Returns the user specified by get_user method for manually creating historical objects

instance_type

alias of AK

property next_record

Get the next history record for the instance. None if last.

property prev_record

Get the previous history record for the instance. None if first.

revert_url()

URL for this change in the default admin site.