diff --git a/requirements.txt b/requirements.txt index 30ce3a0..ccf850f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,12 +9,16 @@ defusedxml==0.7.1 Django==4.0.3 django-allauth==0.50.0 django-crispy-forms==1.14.0 +django-filter==21.1 +djangorestframework==3.13.1 +djangorestframework-gis==0.18 idna==3.3 oauthlib==3.2.0 psycopg2==2.9.3 pycparser==2.21 PyJWT==2.3.0 python3-openid==3.2.0 +pytz==2022.1 requests==2.27.1 requests-oauthlib==1.3.1 sqlparse==0.4.2 diff --git a/wheretogo/maps/__init__.py b/wheretogo/maps/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wheretogo/maps/admin.py b/wheretogo/maps/admin.py new file mode 100644 index 0000000..6970051 --- /dev/null +++ b/wheretogo/maps/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from maps.models import Facility + +admin.site.register(Facility) diff --git a/wheretogo/maps/api.py b/wheretogo/maps/api.py new file mode 100644 index 0000000..4fc1e61 --- /dev/null +++ b/wheretogo/maps/api.py @@ -0,0 +1,8 @@ +from rest_framework import routers + +from maps.viewsets import FacilityViewSet + +router = routers.DefaultRouter() +router.register(r"facilities", FacilityViewSet) + +urlpatterns = router.urls diff --git a/wheretogo/maps/apps.py b/wheretogo/maps/apps.py new file mode 100644 index 0000000..f97db36 --- /dev/null +++ b/wheretogo/maps/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class MapConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "maps" + verbose_name = "Maps" diff --git a/wheretogo/maps/migrations/0001_initial.py b/wheretogo/maps/migrations/0001_initial.py new file mode 100644 index 0000000..4c890ba --- /dev/null +++ b/wheretogo/maps/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 4.0.3 on 2022-04-21 11:59 + +import django.contrib.gis.db.models.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Facility', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200)), + ('address', models.CharField(max_length=100)), + ('city', models.CharField(max_length=50)), + ('location', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), + ], + options={ + 'verbose_name': 'facility', + 'verbose_name_plural': 'Facilities', + }, + ), + ] diff --git a/wheretogo/maps/migrations/__init__.py b/wheretogo/maps/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wheretogo/maps/models.py b/wheretogo/maps/models.py new file mode 100644 index 0000000..ff4fcf4 --- /dev/null +++ b/wheretogo/maps/models.py @@ -0,0 +1,19 @@ +from django.contrib.gis.db import models as gis_models +from django.db import models + + +class Facility(models.Model): + name = models.CharField(max_length=200) + address = models.CharField(max_length=100) + city = models.CharField(max_length=50) + location = gis_models.PointField( + null=True, + blank=True, + ) + + class Meta: + verbose_name = "facility" + verbose_name_plural = "Facilities" + + def __unicode__(self): + return self.name diff --git a/wheretogo/maps/serializers.py b/wheretogo/maps/serializers.py new file mode 100644 index 0000000..577e192 --- /dev/null +++ b/wheretogo/maps/serializers.py @@ -0,0 +1,11 @@ +from rest_framework_gis import serializers + +from maps.models import Facility + + +class FacilitySerializer(serializers.GeoFeatureModelSerializer): + class Meta: + + fields = ("id", "name", "address", "city") + geo_field = "location" + model = Facility diff --git a/wheretogo/maps/tests.py b/wheretogo/maps/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/wheretogo/maps/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/wheretogo/maps/urls.py b/wheretogo/maps/urls.py new file mode 100644 index 0000000..0f93a6f --- /dev/null +++ b/wheretogo/maps/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from maps.views import MapView + +app_name = "maps" + +urlpatterns = [ + path("map/", MapView.as_view(), name="map"), +] diff --git a/wheretogo/maps/views.py b/wheretogo/maps/views.py new file mode 100644 index 0000000..a0befdc --- /dev/null +++ b/wheretogo/maps/views.py @@ -0,0 +1,6 @@ +from django.views.generic.base import TemplateView + + +class MapView(TemplateView): + + template_name = "maps/map.html" diff --git a/wheretogo/maps/viewsets.py b/wheretogo/maps/viewsets.py new file mode 100644 index 0000000..4860f2d --- /dev/null +++ b/wheretogo/maps/viewsets.py @@ -0,0 +1,13 @@ +from rest_framework import viewsets +from rest_framework_gis import filters + +from maps.models import Facility +from maps.serializers import FacilitySerializer + + +class FacilityViewSet(viewsets.ReadOnlyModelViewSet): + + bbox_filter_field = "location" + filter_backends = (filters.InBBoxFilter,) + queryset = Facility.objects.all() + serializer_class = FacilitySerializer diff --git a/wheretogo/static/css/own/map.css b/wheretogo/static/css/own/map.css new file mode 100644 index 0000000..f4a690a --- /dev/null +++ b/wheretogo/static/css/own/map.css @@ -0,0 +1,10 @@ +html, +body { + height: 100%; + margin: 0; +} + +#map { + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/wheretogo/static/css/bootstrap-grid.css b/wheretogo/static/css/thirdparty/bootstrap-grid.css similarity index 100% rename from wheretogo/static/css/bootstrap-grid.css rename to wheretogo/static/css/thirdparty/bootstrap-grid.css diff --git a/wheretogo/static/css/bootstrap-grid.css.map b/wheretogo/static/css/thirdparty/bootstrap-grid.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-grid.css.map rename to wheretogo/static/css/thirdparty/bootstrap-grid.css.map diff --git a/wheretogo/static/css/bootstrap-grid.min.css b/wheretogo/static/css/thirdparty/bootstrap-grid.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-grid.min.css rename to wheretogo/static/css/thirdparty/bootstrap-grid.min.css diff --git a/wheretogo/static/css/bootstrap-grid.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-grid.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-grid.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-grid.min.css.map diff --git a/wheretogo/static/css/bootstrap-grid.rtl.css b/wheretogo/static/css/thirdparty/bootstrap-grid.rtl.css similarity index 100% rename from wheretogo/static/css/bootstrap-grid.rtl.css rename to wheretogo/static/css/thirdparty/bootstrap-grid.rtl.css diff --git a/wheretogo/static/css/bootstrap-grid.rtl.css.map b/wheretogo/static/css/thirdparty/bootstrap-grid.rtl.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-grid.rtl.css.map rename to wheretogo/static/css/thirdparty/bootstrap-grid.rtl.css.map diff --git a/wheretogo/static/css/bootstrap-grid.rtl.min.css b/wheretogo/static/css/thirdparty/bootstrap-grid.rtl.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-grid.rtl.min.css rename to wheretogo/static/css/thirdparty/bootstrap-grid.rtl.min.css diff --git a/wheretogo/static/css/bootstrap-grid.rtl.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-grid.rtl.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-grid.rtl.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-grid.rtl.min.css.map diff --git a/wheretogo/static/css/bootstrap-reboot.css b/wheretogo/static/css/thirdparty/bootstrap-reboot.css similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.css rename to wheretogo/static/css/thirdparty/bootstrap-reboot.css diff --git a/wheretogo/static/css/bootstrap-reboot.css.map b/wheretogo/static/css/thirdparty/bootstrap-reboot.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.css.map rename to wheretogo/static/css/thirdparty/bootstrap-reboot.css.map diff --git a/wheretogo/static/css/bootstrap-reboot.min.css b/wheretogo/static/css/thirdparty/bootstrap-reboot.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.min.css rename to wheretogo/static/css/thirdparty/bootstrap-reboot.min.css diff --git a/wheretogo/static/css/bootstrap-reboot.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-reboot.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-reboot.min.css.map diff --git a/wheretogo/static/css/bootstrap-reboot.rtl.css b/wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.css similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.rtl.css rename to wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.css diff --git a/wheretogo/static/css/bootstrap-reboot.rtl.css.map b/wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.rtl.css.map rename to wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.css.map diff --git a/wheretogo/static/css/bootstrap-reboot.rtl.min.css b/wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.rtl.min.css rename to wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.min.css diff --git a/wheretogo/static/css/bootstrap-reboot.rtl.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-reboot.rtl.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-reboot.rtl.min.css.map diff --git a/wheretogo/static/css/bootstrap-utilities.css b/wheretogo/static/css/thirdparty/bootstrap-utilities.css similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.css rename to wheretogo/static/css/thirdparty/bootstrap-utilities.css diff --git a/wheretogo/static/css/bootstrap-utilities.css.map b/wheretogo/static/css/thirdparty/bootstrap-utilities.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.css.map rename to wheretogo/static/css/thirdparty/bootstrap-utilities.css.map diff --git a/wheretogo/static/css/bootstrap-utilities.min.css b/wheretogo/static/css/thirdparty/bootstrap-utilities.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.min.css rename to wheretogo/static/css/thirdparty/bootstrap-utilities.min.css diff --git a/wheretogo/static/css/bootstrap-utilities.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-utilities.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-utilities.min.css.map diff --git a/wheretogo/static/css/bootstrap-utilities.rtl.css b/wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.css similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.rtl.css rename to wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.css diff --git a/wheretogo/static/css/bootstrap-utilities.rtl.css.map b/wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.rtl.css.map rename to wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.css.map diff --git a/wheretogo/static/css/bootstrap-utilities.rtl.min.css b/wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.min.css similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.rtl.min.css rename to wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.min.css diff --git a/wheretogo/static/css/bootstrap-utilities.rtl.min.css.map b/wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap-utilities.rtl.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap-utilities.rtl.min.css.map diff --git a/wheretogo/static/css/bootstrap.css b/wheretogo/static/css/thirdparty/bootstrap.css similarity index 100% rename from wheretogo/static/css/bootstrap.css rename to wheretogo/static/css/thirdparty/bootstrap.css diff --git a/wheretogo/static/css/bootstrap.css.map b/wheretogo/static/css/thirdparty/bootstrap.css.map similarity index 100% rename from wheretogo/static/css/bootstrap.css.map rename to wheretogo/static/css/thirdparty/bootstrap.css.map diff --git a/wheretogo/static/css/bootstrap.min.css b/wheretogo/static/css/thirdparty/bootstrap.min.css similarity index 100% rename from wheretogo/static/css/bootstrap.min.css rename to wheretogo/static/css/thirdparty/bootstrap.min.css diff --git a/wheretogo/static/css/bootstrap.min.css.map b/wheretogo/static/css/thirdparty/bootstrap.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap.min.css.map diff --git a/wheretogo/static/css/bootstrap.rtl.css b/wheretogo/static/css/thirdparty/bootstrap.rtl.css similarity index 100% rename from wheretogo/static/css/bootstrap.rtl.css rename to wheretogo/static/css/thirdparty/bootstrap.rtl.css diff --git a/wheretogo/static/css/bootstrap.rtl.css.map b/wheretogo/static/css/thirdparty/bootstrap.rtl.css.map similarity index 100% rename from wheretogo/static/css/bootstrap.rtl.css.map rename to wheretogo/static/css/thirdparty/bootstrap.rtl.css.map diff --git a/wheretogo/static/css/bootstrap.rtl.min.css b/wheretogo/static/css/thirdparty/bootstrap.rtl.min.css similarity index 100% rename from wheretogo/static/css/bootstrap.rtl.min.css rename to wheretogo/static/css/thirdparty/bootstrap.rtl.min.css diff --git a/wheretogo/static/css/bootstrap.rtl.min.css.map b/wheretogo/static/css/thirdparty/bootstrap.rtl.min.css.map similarity index 100% rename from wheretogo/static/css/bootstrap.rtl.min.css.map rename to wheretogo/static/css/thirdparty/bootstrap.rtl.min.css.map diff --git a/wheretogo/static/js/bootstrap.bundle.js b/wheretogo/static/js/thirdparty/bootstrap.bundle.js similarity index 100% rename from wheretogo/static/js/bootstrap.bundle.js rename to wheretogo/static/js/thirdparty/bootstrap.bundle.js diff --git a/wheretogo/static/js/bootstrap.bundle.js.map b/wheretogo/static/js/thirdparty/bootstrap.bundle.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.bundle.js.map rename to wheretogo/static/js/thirdparty/bootstrap.bundle.js.map diff --git a/wheretogo/static/js/bootstrap.bundle.min.js b/wheretogo/static/js/thirdparty/bootstrap.bundle.min.js similarity index 100% rename from wheretogo/static/js/bootstrap.bundle.min.js rename to wheretogo/static/js/thirdparty/bootstrap.bundle.min.js diff --git a/wheretogo/static/js/bootstrap.bundle.min.js.map b/wheretogo/static/js/thirdparty/bootstrap.bundle.min.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.bundle.min.js.map rename to wheretogo/static/js/thirdparty/bootstrap.bundle.min.js.map diff --git a/wheretogo/static/js/bootstrap.esm.js b/wheretogo/static/js/thirdparty/bootstrap.esm.js similarity index 100% rename from wheretogo/static/js/bootstrap.esm.js rename to wheretogo/static/js/thirdparty/bootstrap.esm.js diff --git a/wheretogo/static/js/bootstrap.esm.js.map b/wheretogo/static/js/thirdparty/bootstrap.esm.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.esm.js.map rename to wheretogo/static/js/thirdparty/bootstrap.esm.js.map diff --git a/wheretogo/static/js/bootstrap.esm.min.js b/wheretogo/static/js/thirdparty/bootstrap.esm.min.js similarity index 100% rename from wheretogo/static/js/bootstrap.esm.min.js rename to wheretogo/static/js/thirdparty/bootstrap.esm.min.js diff --git a/wheretogo/static/js/bootstrap.esm.min.js.map b/wheretogo/static/js/thirdparty/bootstrap.esm.min.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.esm.min.js.map rename to wheretogo/static/js/thirdparty/bootstrap.esm.min.js.map diff --git a/wheretogo/static/js/bootstrap.js b/wheretogo/static/js/thirdparty/bootstrap.js similarity index 100% rename from wheretogo/static/js/bootstrap.js rename to wheretogo/static/js/thirdparty/bootstrap.js diff --git a/wheretogo/static/js/bootstrap.js.map b/wheretogo/static/js/thirdparty/bootstrap.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.js.map rename to wheretogo/static/js/thirdparty/bootstrap.js.map diff --git a/wheretogo/static/js/bootstrap.min.js b/wheretogo/static/js/thirdparty/bootstrap.min.js similarity index 100% rename from wheretogo/static/js/bootstrap.min.js rename to wheretogo/static/js/thirdparty/bootstrap.min.js diff --git a/wheretogo/static/js/bootstrap.min.js.map b/wheretogo/static/js/thirdparty/bootstrap.min.js.map similarity index 100% rename from wheretogo/static/js/bootstrap.min.js.map rename to wheretogo/static/js/thirdparty/bootstrap.min.js.map diff --git a/wheretogo/static/js/jquery.min.js b/wheretogo/static/js/thirdparty/jquery.min.js similarity index 100% rename from wheretogo/static/js/jquery.min.js rename to wheretogo/static/js/thirdparty/jquery.min.js diff --git a/wheretogo/templates/common/base.html b/wheretogo/templates/common/base.html index 1e740a9..53a43e5 100644 --- a/wheretogo/templates/common/base.html +++ b/wheretogo/templates/common/base.html @@ -8,8 +8,11 @@