Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Kolego
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Onboarding
AlekSIS-App-Kolego
Commits
ab9a0fdc
Commit
ab9a0fdc
authored
1 year ago
by
magicfelix
Browse files
Options
Downloads
Patches
Plain Diff
Make Absence subclass of FreeBusy
parent
df38e1fa
No related branches found
No related tags found
1 merge request
!7
Resolve "Implement Absence model based on FreeBusy"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/kolego/migrations/0001_initial.py
+11
-36
11 additions, 36 deletions
aleksis/apps/kolego/migrations/0001_initial.py
aleksis/apps/kolego/models/absence.py
+2
-7
2 additions, 7 deletions
aleksis/apps/kolego/models/absence.py
with
13 additions
and
43 deletions
aleksis/apps/kolego/migrations/0001_initial.py
+
11
−
36
View file @
ab9a0fdc
# Generated by Django 4.2.
3
on 2023-0
7-31 15:16
# Generated by Django 4.2.
4
on 2023-0
8-17 19:59
import
aleksis.core.managers
from
django.db
import
migrations
,
models
...
...
@@ -11,7 +11,7 @@ class Migration(migrations.Migration):
dependencies
=
[
(
"
sites
"
,
"
0002_alter_domain_unique
"
),
(
"
core
"
,
"
005
2_site_related_name
"
),
(
"
core
"
,
"
005
3_freebusy
"
),
]
operations
=
[
...
...
@@ -62,25 +62,16 @@ class Migration(migrations.Migration):
name
=
"
Absence
"
,
fields
=
[
(
"
id
"
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
"
ID
"
),
),
(
"
managed_by_app_label
"
,
models
.
CharField
(
blank
=
True
,
editable
=
False
,
max_length
=
255
,
verbose_name
=
"
App label of app responsible for managing this instance
"
,
"
freebusy_ptr
"
,
models
.
OneToOneField
(
auto_created
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
parent_link
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
"
core.freebusy
"
,
),
),
(
"
extended_data
"
,
models
.
JSONField
(
default
=
dict
,
editable
=
False
)),
(
"
date_start
"
,
models
.
DateField
(
verbose_name
=
"
Start date
"
)),
(
"
date_end
"
,
models
.
DateField
(
verbose_name
=
"
End date
"
)),
(
"
time_start
"
,
models
.
TimeField
(
blank
=
True
,
null
=
True
,
verbose_name
=
"
Start time
"
)),
(
"
time_end
"
,
models
.
TimeField
(
blank
=
True
,
null
=
True
,
verbose_name
=
"
End time
"
)),
(
"
comment
"
,
models
.
TextField
(
blank
=
True
,
verbose_name
=
"
Comment
"
)),
(
"
person
"
,
...
...
@@ -102,22 +93,12 @@ class Migration(migrations.Migration):
verbose_name
=
"
Absence reason
"
,
),
),
(
"
site
"
,
models
.
ForeignKey
(
default
=
1
,
editable
=
False
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
"
+
"
,
to
=
"
sites.site
"
,
),
),
],
options
=
{
"
verbose_name
"
:
"
Absence
"
,
"
verbose_name_plural
"
:
"
Absences
"
,
"
ordering
"
:
[
"
date_start
"
],
},
bases
=
(
"
core.freebusy
"
,),
),
migrations
.
AddConstraint
(
model_name
=
"
absencereason
"
,
...
...
@@ -126,10 +107,4 @@ class Migration(migrations.Migration):
name
=
"
kolego_unique_short_name_per_site_absence_reason
"
,
),
),
migrations
.
AddIndex
(
model_name
=
"
absence
"
,
index
=
models
.
Index
(
fields
=
[
"
date_start
"
,
"
date_end
"
],
name
=
"
kolego_abse_date_st_846150_idx
"
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/kolego/models/absence.py
+
2
−
7
View file @
ab9a0fdc
...
...
@@ -3,6 +3,7 @@ from django.utils.translation import gettext_lazy as _
from
aleksis.core.managers
import
CurrentSiteManagerWithoutMigrations
from
aleksis.core.mixins
import
ExtensibleModel
from
aleksis.core.models
import
FreeBusy
from
..managers
import
AbsenceQuerySet
...
...
@@ -28,7 +29,7 @@ class AbsenceReason(ExtensibleModel):
]
class
Absence
(
ExtensibleModel
):
class
Absence
(
FreeBusy
):
objects
=
CurrentSiteManagerWithoutMigrations
.
from_queryset
(
AbsenceQuerySet
)()
reason
=
models
.
ForeignKey
(
...
...
@@ -47,17 +48,11 @@ class Absence(ExtensibleModel):
verbose_name
=
_
(
"
Person
"
),
)
date_start
=
models
.
DateField
(
verbose_name
=
_
(
"
Start date
"
))
date_end
=
models
.
DateField
(
verbose_name
=
_
(
"
End date
"
))
time_start
=
models
.
TimeField
(
verbose_name
=
_
(
"
Start time
"
),
blank
=
True
,
null
=
True
)
time_end
=
models
.
TimeField
(
verbose_name
=
_
(
"
End time
"
),
blank
=
True
,
null
=
True
)
comment
=
models
.
TextField
(
verbose_name
=
_
(
"
Comment
"
),
blank
=
True
)
def
__str__
(
self
):
return
f
"
{
self
.
person
}
(
{
self
.
date_start
}
-
{
self
.
date_end
}
)
"
class
Meta
:
ordering
=
[
"
date_start
"
]
indexes
=
[
models
.
Index
(
fields
=
[
"
date_start
"
,
"
date_end
"
])]
verbose_name
=
_
(
"
Absence
"
)
verbose_name_plural
=
_
(
"
Absences
"
)
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