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
Iterations
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
KIF
AKPlanning
Commits
124169d5
Commit
124169d5
authored
2 years ago
by
Nadja Geisler
Browse files
Options
Downloads
Plain Diff
Merge branch 'features-availabilities' into 'main'
Default availability for new AKs Closes
#129
See merge request
!124
parents
e1cebf37
a2cb5722
No related branches found
No related tags found
1 merge request
!124
Default availability for new AKs
Pipeline
#95955
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/availability/models.py
+9
-0
9 additions, 0 deletions
AKModel/availability/models.py
AKSubmission/forms.py
+8
-0
8 additions, 0 deletions
AKSubmission/forms.py
with
17 additions
and
0 deletions
AKModel/availability/models.py
+
9
−
0
View file @
124169d5
...
...
@@ -235,6 +235,15 @@ class Availability(models.Model):
def
simplified
(
self
):
return
f
'
{
self
.
start
.
astimezone
(
self
.
event
.
timezone
).
strftime
(
"
%a %H
:
%
M
"
)
}
-
{
self
.
end
.
astimezone
(
self
.
event
.
timezone
).
strftime
(
"
%a %H
:
%
M
"
)
}
'
@classmethod
def
with_event_length
(
cls
,
event
,
person
=
None
,
room
=
None
,
ak
=
None
,
ak_category
=
None
):
timeframe_start
=
event
.
start
# adapt to our event model
# add 1 day, not 24 hours, https://stackoverflow.com/a/25427822/2486196
timeframe_end
=
event
.
end
# adapt to our event model
timeframe_end
=
timeframe_end
+
datetime
.
timedelta
(
days
=
1
)
return
Availability
(
start
=
timeframe_start
,
end
=
timeframe_end
,
event
=
event
,
person
=
person
,
room
=
room
,
ak
=
ak
,
ak_category
=
ak_category
)
class
Meta
:
verbose_name
=
_
(
'
Availability
'
)
verbose_name_plural
=
_
(
'
Availabilities
'
)
...
...
This diff is collapsed.
Click to expand it.
AKSubmission/forms.py
+
8
−
0
View file @
124169d5
...
...
@@ -6,6 +6,7 @@ from django.core.exceptions import ValidationError
from
django.utils.translation
import
ugettext_lazy
as
_
from
AKModel.availability.forms
import
AvailabilitiesFormMixin
from
AKModel.availability.models
import
Availability
from
AKModel.models
import
AK
,
AKOwner
,
AKCategory
,
AKRequirement
,
AKSlot
,
AKOrgaMessage
,
Event
...
...
@@ -133,6 +134,13 @@ class AKSubmissionForm(AKForm):
self
.
initial
.
get
(
'
event
'
).
default_slot
)
def
clean_availabilities
(
self
):
availabilities
=
super
().
clean_availabilities
()
# If the user did not specify availabilities assume the full event duration is possible
if
len
(
availabilities
)
==
0
:
availabilities
.
append
(
Availability
.
with_event_length
(
event
=
self
.
cleaned_data
[
"
event
"
]))
return
availabilities
class
AKEditForm
(
AKForm
):
...
...
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