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
7000fad2
Verified
Commit
7000fad2
authored
Jun 25, 2017
by
David Haynes
🙆
Browse files
Add GeoJson Point to Location
- (x,y) point where the Facility is located - Pretty map added to admin interface
parent
b6e769a5
Pipeline
#1414
failed with stage
in 1 minute and 11 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
whats-open/api/admin.py
View file @
7000fad2
...
...
@@ -11,7 +11,7 @@ from __future__ import (absolute_import, division, print_function,
# Django Imports
from
django.contrib
import
admin
from
django.contrib.gis.admin
import
OSMGeoAdmin
# App Imports
from
.models
import
Facility
,
Schedule
,
OpenTime
,
Category
,
Location
,
Alert
...
...
@@ -70,7 +70,8 @@ class ScheduleAdmin(admin.ModelAdmin):
# https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#modeladmin-objects
admin
.
site
.
register
(
Facility
,
FacilityAdmin
)
admin
.
site
.
register
(
Schedule
,
ScheduleAdmin
)
# https://docs.djangoproject.com/en/1.11/ref/contrib/gis/admin/#osmgeoadmin
admin
.
site
.
register
(
Location
,
OSMGeoAdmin
)
# Use the default ModelAdmin interface for these
admin
.
site
.
register
(
Category
)
admin
.
site
.
register
(
Location
)
admin
.
site
.
register
(
Alert
)
whats-open/api/models.py
View file @
7000fad2
...
...
@@ -15,6 +15,7 @@ import datetime
# Django Imports
from
django.db
import
models
from
django.contrib.gis.db.models
import
PointField
from
django.contrib.auth.models
import
User
from
django.core.validators
import
RegexValidator
...
...
@@ -58,6 +59,8 @@ class Location(TimeStampedModel):
address
=
models
.
CharField
(
max_length
=
100
)
# Boolean for whether or not the location is "on campus" or not.
on_campus
=
models
.
BooleanField
(
default
=
True
)
# A GeoJson coordinate pair that represents the physical location
coordinate_location
=
PointField
()
class
Meta
:
verbose_name
=
"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