Commit ad3fbe7f authored by David Haynes's avatar 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
...@@ -27,7 +27,7 @@ class FacilityAdmin(admin.ModelAdmin): ...@@ -27,7 +27,7 @@ class FacilityAdmin(admin.ModelAdmin):
# We are basically reordering things to look nicer to the user here # We are basically reordering things to look nicer to the user here
fieldsets = ( fieldsets = (
(None, { (None, {
'fields': ('facility_name', 'facility_category', 'facility_location', 'fields': ('facility_name', 'logo', 'facility_category', 'facility_location',
'main_schedule', 'special_schedules', 'main_schedule', 'special_schedules',
'facility_product_tags', 'tapingo_url', 'owners'), 'facility_product_tags', 'tapingo_url', 'owners'),
}), }),
......
...@@ -106,6 +106,11 @@ class Facility(TimeStampedModel): ...@@ -106,6 +106,11 @@ class Facility(TimeStampedModel):
facility_location = models.ForeignKey('Location', facility_location = models.ForeignKey('Location',
related_name="facilities") 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 # The User(s) that claim ownership over this facility
owners = models.ManyToManyField(User) owners = models.ManyToManyField(User)
......
...@@ -94,7 +94,7 @@ class FacilitySerializer(serializers.HyperlinkedModelSerializer): ...@@ -94,7 +94,7 @@ class FacilitySerializer(serializers.HyperlinkedModelSerializer):
# Choose the model to be serialized # Choose the model to be serialized
model = Facility model = Facility
# List the fields that we are serializing # 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', 'facility_product_tags', 'tapingo_url',
'main_schedule', 'special_schedules', 'main_schedule', 'special_schedules',
'modified', ) 'modified', )
...@@ -363,13 +363,14 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -363,13 +363,14 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
FILTER_FIELDS = ( FILTER_FIELDS = (
# Facility fields # Facility fields
'facility_name', 'facility_name',
'logo',
'tapingo_url', 'tapingo_url',
'facility_product_tags__name', 'facility_product_tags__name',
# Category fields # Category fields
'facility_category__name', 'facility_category__name',
# Location fields # Location fields
'facility_location__building', 'facility_location__building',
'facility_location_friendly_building', 'facility_location__friendly_building',
'facility_location__address', 'facility_location__address',
'facility_location__on_campus', 'facility_location__on_campus',
'facility_location__campus_region', 'facility_location__campus_region',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment