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
f09c84ec
Commit
f09c84ec
authored
Mar 06, 2018
by
Daniel W Bond
Browse files
created new method, added to dropdown
parent
5d3b7e43
Pipeline
#2165
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
whats-open/api/admin.py
View file @
f09c84ec
...
...
@@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/1.11/ref/contrib/admin/
# Django Imports
from
django.contrib
import
admin
from
django.contrib.gis.admin
import
OSMGeoAdmin
from
django.shortcuts
import
render
# App Imports
from
.models
import
Facility
,
Schedule
,
OpenTime
,
Category
,
Location
,
Alert
...
...
@@ -26,7 +27,15 @@ class FacilityAdmin(admin.ModelAdmin):
facility
.
special_schedules
.
clear
()
self
.
message_user
(
request
,
"Successfully removed special schedules from %d facilities."
%
num
)
actions
=
[
drop_special_schedules
,
]
def
assign_bulk_schedules
(
self
,
request
,
queryset
):
return
render
(
request
,
'bulk_schedules_intermediate.html'
,
context
=
{
'facilities'
:
queryset
,
'schedules'
:
Schedule
.
objects
.
all
()})
assign_bulk_schedules
.
short_description
=
'Assign a schedule to multiple facilities'
# a list of all actions to be added
actions
=
[
drop_special_schedules
,
assign_bulk_schedules
,
]
# Allow filtering by the following fields
list_filter
=
[
'facility_category'
,
'facility_location'
]
...
...
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