Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aaron -
AKPlanning
Commits
f5e57411
Commit
f5e57411
authored
5 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Add string representations for AKModel model
Resolve first partial task of #7
parent
7490e84e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/models.py
+42
-0
42 additions, 0 deletions
AKModel/models.py
with
42 additions
and
0 deletions
AKModel/models.py
+
42
−
0
View file @
f5e57411
...
...
@@ -21,6 +21,9 @@ class Event(models.Model):
verbose_name_plural
=
_
(
'
Events
'
)
ordering
=
[
'
name
'
]
def
__str__
(
self
):
return
self
.
name
class
AKOwner
(
models
.
Model
):
"""
An AKOwner describes the person organizing/holding an AK.
...
...
@@ -39,6 +42,11 @@ class AKOwner(models.Model):
ordering
=
[
'
name
'
]
unique_together
=
[[
'
name
'
,
'
institution
'
]]
def
__str__
(
self
):
if
self
.
institution
!=
""
:
return
f
"
{
self
.
name
}
(
{
self
.
institution
}
)
"
return
self
.
name
class
AKType
(
models
.
Model
):
"""
An AKType describes the characteristics of an AK, e.g. content vs. recreational.
...
...
@@ -51,6 +59,9 @@ class AKType(models.Model):
verbose_name_plural
=
_
(
'
AK Types
'
)
ordering
=
[
'
name
'
]
def
__str__
(
self
):
return
self
.
name
class
AKTrack
(
models
.
Model
):
"""
An AKTrack describes a set of semantically related AKs.
...
...
@@ -63,6 +74,9 @@ class AKTrack(models.Model):
verbose_name_plural
=
_
(
'
AK Tracks
'
)
ordering
=
[
'
name
'
]
def
__str__
(
self
):
return
self
.
name
class
AKTag
(
models
.
Model
):
"""
An AKTag is a keyword given to an AK by (one of) its owner(s).
...
...
@@ -74,6 +88,9 @@ class AKTag(models.Model):
verbose_name_plural
=
_
(
'
AK Tags
'
)
ordering
=
[
'
name
'
]
def
__str__
(
self
):
return
self
.
name
class
AKRequirement
(
models
.
Model
):
"""
An AKRequirement describes something needed to hold an AK, e.g. infrastructure.
...
...
@@ -88,6 +105,9 @@ class AKRequirement(models.Model):
verbose_name_plural
=
_
(
'
AK Requirements
'
)
ordering
=
[
'
name
'
]
def
__str__
(
self
):
return
self
.
name
class
AK
(
models
.
Model
):
"""
An AK is a slot-based activity to be scheduled during an event.
...
...
@@ -128,6 +148,11 @@ class AK(models.Model):
verbose_name
=
_
(
'
AK
'
)
verbose_name_plural
=
_
(
'
AKs
'
)
def
__str__
(
self
):
if
self
.
short_name
!=
""
:
return
self
.
short_name
return
self
.
name
class
Room
(
models
.
Model
):
"""
A room describes where an AK can be held.
...
...
@@ -148,6 +173,11 @@ class Room(models.Model):
ordering
=
[
'
building
'
,
'
name
'
]
unique_together
=
[[
'
name
'
,
'
building
'
]]
def
__str__
(
self
):
if
self
.
building
!=
""
:
return
f
"
{
self
.
building
}
{
self
.
name
}
"
return
self
.
name
class
AKSlot
(
models
.
Model
):
"""
An AK Mapping matches an AK to a room during a certain time.
...
...
@@ -166,3 +196,15 @@ class AKSlot(models.Model):
verbose_name
=
_
(
'
AK Slot
'
)
verbose_name_plural
=
_
(
'
AK Slots
'
)
ordering
=
[
'
start
'
,
'
room
'
]
def
__str__
(
self
):
if
self
.
room
is
not
None
:
return
f
"
{
self
.
ak
}
@
{
self
.
start_simplified
}
in
{
self
.
room
}
"
return
f
"
{
self
.
ak
}
@
{
self
.
start_simplified
}
"
@property
def
start_simplified
(
self
):
"""
Display start time of slot in format weekday + time, e.g.
"
Fri 14:00
"
"""
return
self
.
start
.
strftime
(
'
%a %H:%M
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment