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
4cd25242
Commit
4cd25242
authored
Jun 25, 2017
by
David Haynes
🙆
Browse files
Merge branch '34-itsgistime' into 'master'
Resolve "Serve GeoJSON alongside API requests" Closes
#34
See merge request
!23
parents
eb81dac2
da7e3d1d
Pipeline
#1417
passed with stage
in 1 minute and 24 seconds
Changes
6
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
4cd25242
...
...
@@ -10,7 +10,7 @@ types:
before_script
:
-
apt-get update -qy
-
apt-get install -y mysql-client libmysqlclient-dev python-mysqldb
-
apt-get install -y mysql-client libmysqlclient-dev python-mysqldb
libgdal1h libproj-dev proj-data proj-bin
-
pip install -r requirements/test.txt
-
cd whats-open/
-
export WOPEN_SECRET_KEY=$(dd if=/dev/urandom count=100 | tr -dc "A-Za-z0-9" | fold -w 60 | head -n1 2>/dev/null)
...
...
Dockerfile
View file @
4cd25242
...
...
@@ -8,7 +8,7 @@ ENV PYTHONUNBUFFERED 1
# Update the sources list
RUN
apt-get update
RUN
apt-get
install
netcat
-y
RUN
apt-get
install
netcat
libgdal1h libproj-dev proj-data proj-bin
-y
RUN
mkdir
/whats_open
WORKDIR
/whats_open
...
...
requirements/base.txt
View file @
4cd25242
...
...
@@ -7,4 +7,5 @@ mysqlclient==1.3.10
setuptools==36.0.1
django-taggit==0.22.1
django-taggit-serializer==0.1.5
six==1.10.0
\ No newline at end of file
six==1.10.0
djangorestframework-gis==0.11.2
\ No newline at end of file
whats-open/api/admin.py
View file @
4cd25242
...
...
@@ -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 @
4cd25242
...
...
@@ -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"
...
...
whats-open/settings/base.py
View file @
4cd25242
...
...
@@ -126,7 +126,7 @@ FIXTURE_DIRS = (
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.mysql'
,
'ENGINE'
:
'django.
contrib.gis.
db.backends.mysql'
,
'NAME'
:
os
.
environ
[
'WOPEN_DB_NAME'
],
'USER'
:
os
.
environ
[
'WOPEN_DB_USER'
],
'PASSWORD'
:
os
.
environ
[
'WOPEN_DB_PASSWORD'
],
...
...
@@ -221,6 +221,7 @@ INSTALLED_APPS = (
# Admin panel and documentation:
'django.contrib.admin'
,
'django.contrib.admindocs'
,
'django.contrib.gis'
,
# Apps specific for this project go here.
'api'
,
...
...
@@ -229,6 +230,7 @@ INSTALLED_APPS = (
'taggit'
,
'taggit_serializer'
,
'rest_framework'
,
'rest_framework_gis'
,
)
########## END APP CONFIGURATION
...
...
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