Verified Commit 50b46078 authored by David Haynes's avatar David Haynes 🙆
Browse files

Django 2.0 adoption

- woo

Closes #72
parent db203f90
Pipeline #1905 passed with stage
in 1 minute and 27 seconds
......@@ -26,12 +26,6 @@ before_script:
- python manage.py migrate
- echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('root', 'root@srct.gmu.edu', 'root') " | python manage.py shell
whats-open-py2.7:
image: library/python:2.7
type: test
script:
- python manage.py test
whats-open-py3.5:
image: library/python:3.5
type: test
......
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.0.0] - 2017-06-20
### Added
- New visual identity by @tylerfortune8.
- Version navigation.
- Links to latest released version in previous versions.
- "Why keep a changelog?" section.
- "Who needs a changelog?" section.
- "How do I make a changelog?" section.
- "Frequently Asked Questions" section.
- New "Guiding Principles" sub-section to "How do I make a changelog?".
- Simplified and Traditional Chinese translations from @tianshuo.
- German translation from @mpbzh & @Art4.
- Italian translation from @azkidenz.
- Swedish translation from @magol.
- Turkish translation from @karalamalar.
- French translation from @zapashcanon.
- Brazilian Portugese translation from @aisamu.
- Polish translation from @amielucha.
- Russian translation from @aishek.
- Czech translation from @h4vry.
- Slovak translation from @jkostolansky.
### Changed
- Start using "changelog" over "change log" since it's the common usage.
- Start versioning based on the current English version at 0.3.0 to help
translation authors keep things up-to-date.
- Rewrite "What makes unicorns cry?" section.
- Rewrite "Ignoring Deprecations" sub-section to clarify the ideal
scenario.
- Improve "Commit log diffs" sub-section to further argument against
them.
- Merge "Why can’t people just use a git log diff?" with "Commit log
diffs"
- Fix typos in Simplified Chinese and Traditional Chinese translations.
- Fix typos in Brazilian Portugese translation.
- Fix typos in Turkish translation.
- Fix typos in Czech translation.
- Fix typos in Swedish translation.
- Improve phrasing in French translation.
- Fix phrasing and spelling in German translation.
### Removed
- Section about "changelog" vs "CHANGELOG".
## [0.3.0] - 2015-12-03
### Added
- RU translation from @aishek.
- pt-BR translation from @tallesl.
- es-ES translation from @ZeliosAriex.
## [0.2.0] - 2015-10-06
### Changed
- Remove exclusionary mentions of "open source" since this project can
benefit both "open" and "closed" source projects equally.
## [0.1.0] - 2015-10-06
### Added
- Answer "Should you ever rewrite a change log?".
### Changed
- Improve argument against commit logs.
- Start following [SemVer](http://semver.org) properly.
## [0.0.8] - 2015-02-17
### Changed
- Update year to match in every README example.
- Reluctantly stop making fun of Brits only, since most of the world
writes dates in a strange way.
### Fixed
- Fix typos in recent README changes.
- Update outdated unreleased diff link.
## [0.0.7] - 2015-02-16
### Added
- Link, and make it obvious that date format is ISO 8601.
### Changed
- Clarified the section on "Is there a standard change log format?".
### Fixed
- Fix Markdown links to tag comparison URL with footnote-style links.
## [0.0.6] - 2014-12-12
### Added
- README section on "yanked" releases.
## [0.0.5] - 2014-08-09
### Added
- Markdown links to version tags on release headings.
- Unreleased section to gather unreleased changes and encourage note
keeping prior to releases.
## [0.0.4] - 2014-08-09
### Added
- Better explanation of the difference between the file ("CHANGELOG")
and its function "the change log".
### Changed
- Refer to a "change log" instead of a "CHANGELOG" throughout the site
to differentiate between the file and the purpose of the file — the
logging of changes.
### Removed
- Remove empty sections from CHANGELOG, they occupy too much space and
create too much noise in the file. People will have to assume that the
missing sections were intentionally left out because they contained no
notable changes.
## [0.0.3] - 2014-08-09
### Added
- "Why should I care?" section mentioning The Changelog podcast.
## [0.0.2] - 2014-07-10
### Added
- Explanation of the recommended reverse chronological release ordering.
## 0.0.1 - 2014-05-31
### Added
- This CHANGELOG file to hopefully serve as an evolving example of a
standardized open source project CHANGELOG.
- CNAME file to enable GitHub Pages custom domain
- README now contains answers to common questions about CHANGELOGs
- Good examples and basic guidelines, including proper date formatting.
- Counter-examples: "What makes unicorns cry?"
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
[0.3.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.8...v0.1.0
[0.0.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.7...v0.0.8
[0.0.7]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.6...v0.0.7
[0.0.6]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.5...v0.0.6
[0.0.5]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.4...v0.0.5
[0.0.4]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.1...v0.0.2
Django >= 1.11, < 2.0
django-autoslug==1.9.3
Django >= 2.0, < 2.1
django-autoslug-iplweb
django-cas-client==1.3.0
djangorestframework==3.7.0
djangorestframework==3.7.7
django-model-utils==3.0.0
mysqlclient==1.3.10
mysqlclient==1.3.12
setuptools==36.2.0
django-taggit==0.22.1
django-taggit==0.22.2
django-taggit-serializer==0.1.5
six==1.10.0
djangorestframework-gis==0.11.2
djangorestframework-gis==0.12.0
django-filter==1.0.4
django-crispy-forms==1.6.1
markdown==2.6.8
coreapi==2.3.1
django-crispy-forms==1.7.0
markdown==2.6.10
coreapi==2.3.3
urllib3==1.22
docutils==0.13.1
\ No newline at end of file
......@@ -2,4 +2,4 @@
# production that isn't in development.
-r base.txt
gunicorn>=19.0,<20.0
\ No newline at end of file
gunicorn
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
api/admin.py
......@@ -5,10 +7,6 @@ Django admin interface configuration.
https://docs.djangoproject.com/en/1.11/ref/contrib/admin/
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Django Imports
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
......
......@@ -8,10 +8,6 @@ the API.
https://docs.djangoproject.com/en/1.11/topics/db/models/
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python stdlib Imports
import datetime
......@@ -98,7 +94,7 @@ class Location(TimeStampedModel):
class StupidFacilityLabelHack(TagBase):
pass
class StupidLabelHack(GenericTaggedItemBase):
tag = models.ForeignKey(StupidFacilityLabelHack)
tag = models.ForeignKey(StupidFacilityLabelHack, on_delete=models.CASCADE)
class Facility(TimeStampedModel):
"""
......@@ -113,10 +109,12 @@ class Facility(TimeStampedModel):
# The category that this facility can be grouped with
facility_category = models.ForeignKey('Category',
related_name="categories")
related_name="categories",
on_delete=models.CASCADE)
# The location object that relates to this facility
facility_location = models.ForeignKey('Location',
related_name="facilities")
related_name="facilities",
on_delete=models.CASCADE)
# A note that can be left on a Facility to provide some additional
# information.
......@@ -133,7 +131,8 @@ class Facility(TimeStampedModel):
# The schedule that is defaulted to if no special schedule is in effect
main_schedule = models.ForeignKey('Schedule',
related_name='facility_main')
related_name='facility_main',
on_delete=models.CASCADE)
# A schedule that has a specific start and end date
special_schedules = models.ManyToManyField('Schedule',
related_name='facility_special',
......@@ -316,7 +315,8 @@ class OpenTime(TimeStampedModel):
)
# The schedule that this period of open time is a part of
schedule = models.ForeignKey('Schedule', related_name='open_times')
schedule = models.ForeignKey('Schedule', related_name='open_times',
on_delete=models.CASCADE)
# The day that the open time begins on
start_day = models.IntegerField(default=0, choices=DAY_CHOICES)
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
api/serializers.py
......@@ -6,10 +8,6 @@ can then be easily rendered into JSON, XML or other content types.
http://www.django-rest-framework.org/api-guide/serializers
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# App Imports
from .models import Category, Facility, Schedule, OpenTime, Location, Alert
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
api/urls.py
......@@ -5,12 +7,8 @@ Define the routes that the API will serve content through.
http://www.django-rest-framework.org/api-guide/routers/
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Django Imports
from django.conf.urls import include, url
from django.urls import include, path
from django.views.generic.base import RedirectView
# App Imports
......@@ -33,7 +31,7 @@ ROUTER.register(r'schedules', ScheduleViewSet, 'schedule')
urlpatterns = [
# / - Default route
# We redirect to /api since this is in reality the default page for the API
url(r'^$', RedirectView.as_view(url='/api')),
path('', RedirectView.as_view(url='/api')),
# /api - Root API URL
url(r'^api/', include(ROUTER.urls)),
path('api/', include(ROUTER.urls)),
]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
api/views.py
......@@ -6,10 +8,6 @@ Rest Framework Class Views
Each ViewSet determines what data is returned when an API endpoint is hit. In
addition, we define filtering and documentation for each of these endpoints.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python std. lib. imports
import datetime
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
manage.py
Do not touch at all. This is the main entry point for interacting with Django.
"""
#!/usr/bin/env python
import os
import sys
......
""""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
settings/base.py
Base Django settings for whats-open.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python std. lib. imports
import os
import sys
......@@ -183,7 +181,7 @@ TEMPLATES = [
MIDDLEWARE CONFIGURATION
"""
# See: https://docs.djangoproject.com/en/dev/ref/settings/#middleware-classes
MIDDLEWARE_CLASSES = (
MIDDLEWARE = [
# Default Django middleware.
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
......@@ -191,7 +189,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
]
"""
URL CONFIGURATION
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
settings/local.py
Development settings and globals.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Import the base settings and override where necessary
from .base import *
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
settings/production.py
Production settings and globals.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Python std. lib imports
from os import environ
......@@ -23,6 +21,7 @@ def get_env_setting(setting):
try:
return environ[setting]
except KeyError as ex:
print(str(ex))
error_msg = "Set the %s env variable" % setting
raise ImproperlyConfigured(error_msg)
......@@ -53,4 +52,4 @@ SECRET CONFIGURATION
"""
# See: https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = get_env_setting('WOPEN_SECRET_KEY')
########## END SECRET CONFIGURATION
\ No newline at end of file
########## END SECRET CONFIGURATION
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
settings/urls.py
Top level url patterns.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Django Imports
from django.conf.urls import include, url
from django.urls import include, path
from django.contrib import admin
import django.contrib.auth.views
......@@ -18,17 +16,17 @@ admin.autodiscover()
# Define all the top level url patterns in a list
urlpatterns = [
# / - Load in all urls from the `api` app
url(r'^', include('api.urls')),
path('', include('api.urls')),
# /admin/docs - Documentation for admin
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/doc/', include('django.contrib.admindocs.urls')),
# /admin - The admin panels
url(r'^admin/', include(admin.site.urls)),
path('admin/', admin.site.urls),
# /api-auth - API Auth page
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
# /logout - Redirect to the homepage on logout
url(r'^logout/$', django.contrib.auth.views.logout, {'next_page': '/'}),
path('logout/', django.contrib.auth.views.logout, {'next_page': '/'}),
]
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