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
fromAKOwner
) – All AK Owners of this Event (related name ofevent
)akcategory (Reverse
ForeignKey
fromAKCategory
) – All AK Categories of this Event (related name ofevent
)aktrack (Reverse
ForeignKey
fromAKTrack
) – All AK Tracks of this Event (related name ofevent
)akrequirement (Reverse
ForeignKey
fromAKRequirement
) – All AK Requirements of this Event (related name ofevent
)ak (Reverse
ForeignKey
fromAK
) – All AKs of this Event (related name ofevent
)room (Reverse
ForeignKey
fromRoom
) – All Rooms of this Event (related name ofevent
)akslot (Reverse
ForeignKey
fromAKSlot
) – All AK Slots of this Event (related name ofevent
)akorgamessage (Reverse
ForeignKey
fromAKOrgaMessage
) – All AK Orga Messages of this Event (related name ofevent
)constraintviolation (Reverse
ForeignKey
fromConstraintViolation
) – All Constraint Violations of this Event (related name ofevent
)defaultslot (Reverse
ForeignKey
fromDefaultSlot
) – All Default Slots of this Event (related name ofevent
)availabilities (Reverse
ForeignKey
fromAvailability
) – All availabilities of this Event (related name ofevent
)dashboardbutton (Reverse
ForeignKey
fromDashboardButton
) – All Dashboard Buttons of this Event (related name ofevent
)
- 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:
- 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:
- Returns:
list of category-AK-list-tuples, optionally the additional list of AK wishes
- Return type:
- class AKModel.models.AKOwner(*args, **kwargs)[source]
Bases:
Model
Database table:
AKModel_akowner
An AKOwner describes the person organizing/holding an AK.
- Parameters:
Relationship fields:
- Parameters:
event (
ForeignKey
toEvent
) – Event. Associated event (related name:akowner
)
Reverse relationships:
- Parameters:
ak (Reverse
ManyToManyField
fromAK
) – All AKs of this AK Owner (related name ofowners
)constraintviolation (Reverse
ForeignKey
fromConstraintViolation
) – All Constraint Violations of this AK Owner (related name ofak_owner
)availabilities (Reverse
ForeignKey
fromAvailability
) – All availabilities of this AK Owner (related name ofperson
)
- 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
toEvent
) – Event. Associated event (related name:akcategory
)
Reverse relationships:
- Parameters:
ak (Reverse
ForeignKey
fromAK
) – All AKs of this AK Category (related name ofcategory
)constraintviolation (Reverse
ForeignKey
fromConstraintViolation
) – All Constraint Violations of this AK Category (related name ofcategory
)defaultslot (Reverse
ManyToManyField
fromDefaultSlot
) – All Default Slots of this AK Category (related name ofprimary_categories
)availabilities (Reverse
ForeignKey
fromAvailability
) – All availabilities of this AK Category (related name ofak_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
toEvent
) – Event. Associated event (related name:aktrack
)
Reverse relationships:
- Parameters:
ak (Reverse
ForeignKey
fromAK
) – All AKs of this AK Track (related name oftrack
)
- 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.
Relationship fields:
- Parameters:
event (
ForeignKey
toEvent
) – Event. Associated event (related name:akrequirement
)
Reverse relationships:
- Parameters:
ak (Reverse
ManyToManyField
fromAK
) – All AKs of this AK Requirement (related name ofrequirements
)room (Reverse
ManyToManyField
fromRoom
) – All Rooms of this AK Requirement (related name ofproperties
)constraintviolation (Reverse
ForeignKey
fromConstraintViolation
) – All Constraint Violations of this AK Requirement (related name ofrequirement
)
- 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
toAKCategory
) – Category. Category of the AK (related name:ak
)track (
ForeignKey
toAKTrack
) – Track. Track the AK belongs to (related name:ak
)event (
ForeignKey
toEvent
) – Event. Associated event (related name:ak
)owners (
ManyToManyField
toAKOwner
) – Owners. Those organizing the AK (related name:ak
)requirements (
ManyToManyField
toAKRequirement
) – Requirements. AK’s Requirements (related name:ak
)conflicts (
ManyToManyField
toAK
) – Conflicting AKs. AKs that conflict and thus must not take place at the same time (related name:conflict
)prerequisites (
ManyToManyField
toAK
) – Prerequisite AKs. AKs that should precede this AK in the schedule (related name:ak
)
Reverse relationships:
- Parameters:
conflict (Reverse
ManyToManyField
fromAK
) – All conflict of this AK (related name ofconflicts
)ak (Reverse
ManyToManyField
fromAK
) – All AKs of this AK (related name ofprerequisites
)akslot (Reverse
ForeignKey
fromAKSlot
) – All AK Slots of this AK (related name ofak
)akorgamessage (Reverse
ForeignKey
fromAKOrgaMessage
) – All AK Orga Messages of this AK (related name ofak
)constraintviolation (Reverse
ManyToManyField
fromConstraintViolation
) – All Constraint Violations of this AK (related name ofaks
)availabilities (Reverse
ForeignKey
fromAvailability
) – All availabilities of this AK (related name ofak
)
- 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:
- 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:
- 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:
event (
ForeignKey
toEvent
) – Event. Associated event (related name:room
)properties (
ManyToManyField
toAKRequirement
) – Properties. AK requirements fulfilled by the room (related name:room
)
Reverse relationships:
- Parameters:
akslot (Reverse
ForeignKey
fromAKSlot
) – All AK Slots of this Room (related name ofroom
)constraintviolation (Reverse
ForeignKey
fromConstraintViolation
) – All Constraint Violations of this Room (related name ofroom
)availabilities (Reverse
ForeignKey
fromAvailability
) – All availabilities of this Room (related name ofroom
)virtual (Reverse
OneToOneField
fromVirtualRoom
) – The virtual of this Room (related name ofroom
)
- 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:
id (AutoField) – Primary key: ID
start (DateTimeField) – Slot Begin. Time and date the slot begins
duration (DecimalField) – Duration. Length in hours
fixed (BooleanField) – Scheduling fixed. Length and time of this AK should not be changed
updated (DateTimeField) – Last update
Relationship fields:
- Parameters:
ak (
ForeignKey
toAK
) – AK. AK being mapped (related name:akslot
)room (
ForeignKey
toRoom
) – Room. Room the AK will take place in (related name:akslot
)event (
ForeignKey
toEvent
) – Event. Associated event (related name:akslot
)
Reverse relationships:
- Parameters:
constraintviolation (Reverse
ManyToManyField
fromConstraintViolation
) – All Constraint Violations of this AK Slot (related name ofak_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
- 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
toAK
) – AK. AK this message belongs to (related name:akorgamessage
)event (
ForeignKey
toEvent
) – 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
toEvent
) – Event. Associated event (related name:constraintviolation
)ak_owner (
ForeignKey
toAKOwner
) – AK Owner. AK Owner belonging to this constraint (related name:constraintviolation
)room (
ForeignKey
toRoom
) – Room. Room belonging to this constraint (related name:constraintviolation
)requirement (
ForeignKey
toAKRequirement
) – AK Requirement. AK Requirement belonging to this constraint (related name:constraintviolation
)category (
ForeignKey
toAKCategory
) – AK Category. AK Category belonging to this constraint (related name:constraintviolation
)aks (
ManyToManyField
toAK
) – AKs. AK(s) belonging to this constraint (related name:constraintviolation
)ak_slots (
ManyToManyField
toAKSlot
) – 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
- get_details()[source]
Get details of this constraint (all fields connected to it) :return: string of details :rtype: str
- property details
Property: Details
- 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:
- 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:
id (AutoField) – Primary key: ID
start (DateTimeField) – Slot Begin. Time and date the slot begins
end (DateTimeField) – Slot End. Time and date the slot ends
Relationship fields:
- Parameters:
event (
ForeignKey
toEvent
) – Event. Associated event (related name:defaultslot
)primary_categories (
ManyToManyField
toAKCategory
) – 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
- 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:
category (
ForeignKey
toAKCategory
) – Category. Category of the AK (related name:+
)track (
ForeignKey
toAKTrack
) – Track. Track the AK belongs to (related name:+
)event (
ForeignKey
toEvent
) – Event. Associated event (related name:+
)history_user (
ForeignKey
toUser
) – History user (related name:+
)
- static get_default_history_user(instance)
Returns the user specified by get_user method for manually creating historical objects
- 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.