Unverified Commit a6b37378 authored by David Haynes's avatar David Haynes 🙆
Browse files

feat: Add "address" API endpoint to Facility

- each Facility _may_ have a building it is located in
which _may_ have an address
- allow someone to query for that Facility address
- allow someone on the admin page to input a Facility address

Closes #38

Signed-off-by: David Haynes's avatarDavid Haynes <dhaynes3@gmu.edu>
parent e4d7f839
Pipeline #1218 passed with stage
in 46 seconds
......@@ -23,7 +23,7 @@ class FacilityAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('name', 'facility_category',
('location', 'on_campus'),
('location', 'on_campus'), 'address',
'main_schedule', 'special_schedules', ),
}),
('Advanced', {
......@@ -47,5 +47,4 @@ class CategoryAdmin(admin.ModelAdmin):
admin.site.register(Facility, FacilityAdmin)
admin.site.register(Schedule, ScheduleAdmin)
#admin.site.register(OpenTime, OpenTimeAdmin)
admin.site.register(Category, CategoryAdmin)
......@@ -19,7 +19,8 @@ def export_data():
for facility in alphalist:
facility_data = {
'name': facility.name,
'location': facility.location,
'location': facility.location,
'address': facility.address,
'id': facility.id
}
open_times = list()
......
......@@ -31,6 +31,7 @@ class Facility(TimeStampedModel):
facility_category = models.ForeignKey('Category', related_name="facilities", null=True, blank=True)
on_campus = models.BooleanField(default=True)
location = models.CharField(max_length=100, null=True, blank=True)
address = models.CharField(max_length=100, null=True, blank=True)
owners = models.ManyToManyField(User)
main_schedule = models.ForeignKey('Schedule',
......
......@@ -31,5 +31,5 @@ class FacilitySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Facility
fields = ( 'id', 'category', 'main_schedule', 'special_schedules', 'location', 'modified', 'name' )
fields = ('id', 'category', 'main_schedule', 'special_schedules',
'location', 'address', 'modified', 'name')
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