Verified Commit 2447a60e authored by David Haynes's avatar David Haynes 🙆
Browse files

Support Facility logos to be served through the api

- It's a URLField
- Depends on trusting the admins not to insert dirty images to be sent to clients
- pls

Closes #37
parent ea852337
Pipeline #1727 passed with stage
in 1 minute and 33 seconds
......@@ -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'),
}),
......
......@@ -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)
......
......@@ -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', )
......@@ -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',
......
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