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
ad3fbe7f
Commit
ad3fbe7f
authored
Nov 03, 2017
by
David Haynes
🙆
Browse files
Merge branch '37-facility-logo' into '2.1-dev'
Support Facility logos to be served through the api See merge request
!32
parents
ea852337
2447a60e
Pipeline
#1729
passed with stage
in 1 minute and 38 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
whats-open/api/admin.py
View file @
ad3fbe7f
...
...
@@ -27,7 +27,7 @@ class FacilityAdmin(admin.ModelAdmin):
# We are basically reordering things to look nicer to the user here
fieldsets
=
(
(
None
,
{
'fields'
:
(
'facility_name'
,
'facility_category'
,
'facility_location'
,
'fields'
:
(
'facility_name'
,
'logo'
,
'facility_category'
,
'facility_location'
,
'main_schedule'
,
'special_schedules'
,
'facility_product_tags'
,
'tapingo_url'
,
'owners'
),
}),
...
...
whats-open/api/models.py
View file @
ad3fbe7f
...
...
@@ -106,6 +106,11 @@ class Facility(TimeStampedModel):
facility_location
=
models
.
ForeignKey
(
'Location'
,
related_name
=
"facilities"
)
# A link to the logo image for this Facility
logo
=
models
.
URLField
(
'Logo URL'
,
blank
=
True
,
default
=
"https://imgur.com/q2Phkn9.png"
,
help_text
=
"The absolute URL to the logo image for this Facility."
)
# The User(s) that claim ownership over this facility
owners
=
models
.
ManyToManyField
(
User
)
...
...
whats-open/api/serializers.py
View file @
ad3fbe7f
...
...
@@ -94,7 +94,7 @@ class FacilitySerializer(serializers.HyperlinkedModelSerializer):
# Choose the model to be serialized
model
=
Facility
# List the fields that we are serializing
fields
=
(
'slug'
,
'facility_name'
,
'facility_location'
,
'facility_category'
,
fields
=
(
'slug'
,
'facility_name'
,
'logo'
,
'facility_location'
,
'facility_category'
,
'facility_product_tags'
,
'tapingo_url'
,
'main_schedule'
,
'special_schedules'
,
'modified'
,
)
whats-open/api/views.py
View file @
ad3fbe7f
...
...
@@ -363,13 +363,14 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
FILTER_FIELDS
=
(
# Facility fields
'facility_name'
,
'logo'
,
'tapingo_url'
,
'facility_product_tags__name'
,
# Category fields
'facility_category__name'
,
# Location fields
'facility_location__building'
,
'facility_location_friendly_building'
,
'facility_location_
_
friendly_building'
,
'facility_location__address'
,
'facility_location__on_campus'
,
'facility_location__campus_region'
,
...
...
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