Skip to content

Commit

Permalink
Merge pull request #24 from maykinmedia/feature/46-locatie-nl-api
Browse files Browse the repository at this point in the history
Feature/46 locatie nl api
  • Loading branch information
Floris272 authored Jan 6, 2025
2 parents 573b670 + f6ee749 commit 31c2fc4
Show file tree
Hide file tree
Showing 52 changed files with 2,403 additions and 479 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

services:
postgres:
image: postgis/postgis:15-3.4
image: postgres:15
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
Expand All @@ -75,7 +75,7 @@ jobs:
optimize-postgres: 'yes'
pg-service: 'postgres'
setup-node: 'no'
apt-packages: 'gdal-bin gettext'
apt-packages: 'gettext'

- name: Run tests
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

services:
postgres:
image: postgis/postgis:15-3.4
image: postgres:15
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
Expand All @@ -96,7 +96,6 @@ jobs:
with:
python-version: '3.11'
setup-node: 'no'
apt-packages: 'gdal-bin'
- name: Run makemigrations to check for missing migrations
run: |
src/manage.py makemigrations \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/oas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
python-version: '3.11'
optimize-postgres: 'no'
setup-node: 'no'
apt-packages: 'gdal-bin'
# apt-packages: 'gettext postgresql-client' # the default
# npm-ci-flags: '--legacy-peer-deps' -> preferably use a .npmrc file

Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-reco
mime-support \
postgresql-client \
gettext \
libgdal32 \
shared-mime-info \
# lxml deps
# libxslt \
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You need the following libraries and/or programs:

* `Python`_ - check the ``Dockerfile`` for the required version.
* Python `Virtualenv`_ and `Pip`_
* `PostgreSQL`_ with PostGIS extension
* `PostgreSQL`_
* `Node.js`_
* `npm`_

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
# NOTE: No persistance storage configured.
# Using v14 to prevent schema permissions. See also docker-init-db.sql.
# See: https://hub.docker.com/_/postgres/
image: postgis/postgis:14-3.4
image: postgres:15
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
Expand All @@ -26,4 +26,4 @@ services:
ports:
- 8000:8000
depends_on:
- db
- db
3 changes: 0 additions & 3 deletions docker-init-db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ GRANT ALL PRIVILEGES ON DATABASE open_producten TO open_producten;
ALTER USER open_producten SUPERUSER;
-- On Postgres 15+, connect to the database and grant schema permissions.
-- GRANT USAGE, CREATE ON SCHEMA public TO openforms;

\c open_producten;
CREATE EXTENSION postgis;
1 change: 0 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ open-api-framework
# API libraries
# django-extra-fields
django-markdownx
geopy
django-localflavor

# waiting for > 2.0.1
Expand Down
4 changes: 0 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@ furl==2.1.3
# via ape-pie
gemma-zds-client==2.0.0
# via commonground-api-common
geographiclib==2.0
# via geopy
geopy==2.4.1
# via -r requirements/base.in
glom==24.11.0
# via mozilla-django-oidc-db
humanize==4.11.0
Expand Down
9 changes: 0 additions & 9 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,6 @@ gemma-zds-client==2.0.0
# -c requirements/base.txt
# -r requirements/base.txt
# commonground-api-common
geographiclib==2.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
# geopy
geopy==2.4.1
# via
# -c requirements/base.txt
# -r requirements/base.txt
glom==24.11.0
# via
# -c requirements/base.txt
Expand Down
9 changes: 0 additions & 9 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,6 @@ gemma-zds-client==2.0.0
# -c requirements/ci.txt
# -r requirements/ci.txt
# commonground-api-common
geographiclib==2.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# geopy
geopy==2.4.1
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
gitdb==4.0.11
# via gitpython
gitpython==3.1.43
Expand Down
14 changes: 2 additions & 12 deletions src/open_producten/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,16 @@
"rest_framework.authtoken",
"localflavor",
"markdownx",
"django.contrib.gis",
"open_producten.accounts",
"open_producten.utils",
"open_producten.producttypen",
# "open_producten.products",
# "open_producten.locations",
"open_producten.locaties",
]

DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"ENGINE": "django.db.backends.postgresql",
"NAME": config("DB_NAME", PROJECT_DIRNAME),
"USER": config("DB_USER", PROJECT_DIRNAME),
"PASSWORD": config("DB_PASSWORD", PROJECT_DIRNAME),
Expand Down Expand Up @@ -120,15 +119,6 @@
"COMPONENT_SPLIT_REQUEST": True,
}

#
# geopy
#

GEOPY_APP = "Openproducten"
GEOPY_TIMEOUT = 10 # in seconds
LOCATION_SERVICE_URL = "https://api.pdok.nl/bzk/locatieserver/search/v3_1/free"
GEOCODER = "open_producten.utils.geocode.PdocLocatieserver"

# Subpath (optional)
# This environment variable can be configured during deployment.
SUBPATH = config("SUBPATH", None)
Expand Down
2 changes: 1 addition & 1 deletion src/open_producten/conf/local_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

DATABASES = {
"default": {
"ENGINE": "django.contrib.gis.db.backends.postgis",
"ENGINE": "django.db.backends.postgresql",
"NAME": "open_producten",
"USER": "open_producten",
"PASSWORD": "open_producten",
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions src/open_producten/locaties/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from .contact import ContactAdmin
from .locatie import LocatieAdmin
from .organisatie import OrganisatieAdmin

__all__ = [
"ContactAdmin",
"LocatieAdmin",
"OrganisatieAdmin",
]
13 changes: 13 additions & 0 deletions src/open_producten/locaties/admin/contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.contrib import admin

from ..models import Contact


@admin.register(Contact)
class ContactAdmin(admin.ModelAdmin):
list_display = ("__str__", "organisatie")
list_filter = ("organisatie", "organisatie__stad")
search_fields = ("voornaam", "achternaam", "organisatie__naam")

def get_queryset(self, request):
return super().get_queryset(request).select_related("organisatie")
10 changes: 10 additions & 0 deletions src/open_producten/locaties/admin/locatie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin

from ..models import Locatie


@admin.register(Locatie)
class LocatieAdmin(admin.ModelAdmin):
list_display = ("naam", "stad", "postcode", "straat", "huisnummer")
list_filter = ("stad",)
search_fields = ("naam", "stad", "postcode", "straat")
23 changes: 23 additions & 0 deletions src/open_producten/locaties/admin/organisatie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.contrib import admin
from django.utils.translation import gettext_lazy as _

from ..models import Organisatie


@admin.register(Organisatie)
class OrganisatieAdmin(admin.ModelAdmin):
list_display = ("naam",)
list_filter = ("stad",)
search_fields = ("naam", "stad", "postcode", "straat")

fieldsets = (
(
None,
{"fields": ("naam",)},
),
(_("Contact"), {"fields": ("email", "telefoonnummer")}),
(
_("Address"),
{"fields": ("straat", "huisnummer", "postcode", "stad")},
),
)
6 changes: 6 additions & 0 deletions src/open_producten/locaties/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class LocatiesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "open_producten.locaties"
Loading

0 comments on commit 31c2fc4

Please sign in to comment.