Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
89e3f4f1
Commit
89e3f4f1
authored
Nov 02, 2017
by
David Haynes
🙆
Browse files
Merge branch '70-valid-dates-datetime' into '2.1-dev'
Alter valid_end and valid_start to use DateTime See merge request
!28
parents
ccade0a0
4fb2679b
Pipeline
#1715
passed with stage
in 1 minute and 50 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
whats-open/api/models.py
View file @
89e3f4f1
...
...
@@ -187,12 +187,13 @@ class Schedule(TimeStampedModel):
# The start date of the schedule
# (inclusive)
valid_start
=
models
.
DateField
(
'Start Date'
,
null
=
True
,
blank
=
True
,
help_text
=
"Date that this schedule goes into effect"
)
valid_start
=
models
.
Date
Time
Field
(
'Start Date'
,
null
=
True
,
blank
=
True
,
help_text
=
"Date
& time
that this schedule goes into effect"
)
# The end date of the schedule
# (inclusive)
valid_end
=
models
.
DateField
(
'End Date'
,
null
=
True
,
blank
=
True
,
help_text
=
"Last day that this schedule is in effect"
)
valid_end
=
models
.
DateTimeField
(
'End Date'
,
null
=
True
,
blank
=
True
,
help_text
=
"Last date & time that this schedule is in effect"
)
# Boolean for if this schedule is 24 hours
twenty_four_hours
=
models
.
BooleanField
(
'24 hour schedule?'
,
blank
=
True
,
default
=
False
,
help_text
=
"Toggle to True if the Facility is open 24 hours. You do not need to specify any Open Times, it will always be displayed as open."
)
...
...
whats-open/api/views.py
View file @
89e3f4f1
...
...
@@ -509,7 +509,7 @@ class ScheduleViewSet(viewsets.ModelViewSet):
for
schedule
in
Schedule
.
objects
.
all
()
# If the schedule ended before today
if
schedule
.
valid_end
and
schedule
.
valid_start
if
schedule
.
valid_end
<
datetime
.
date
.
today
()
if
schedule
.
valid_end
<
datetime
.
today
()
]
# Return all Schedule objects that have not expired
return
Schedule
.
objects
.
exclude
(
pk__in
=
filter_old_schedules
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment