Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/3.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Dec 13, 2023
2 parents 09ee001 + a914fcf commit 88360d5
Show file tree
Hide file tree
Showing 46 changed files with 2,091 additions and 1,721 deletions.
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Copy this to `.env` and adapt to your needs.

# Which docker-compose to load (ON PRODUCTION, USE ONLY docker-compose.yml !!)
# If you need to connect to thumbor image service, simply use:
# COMPOSE_FILE=docker-compose.yml:docker-compose.thumbor.yml
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
COMPOSE_PATH_SEPARATOR=:

Expand Down Expand Up @@ -66,13 +68,15 @@ DRF_THROTTLE_RATE_PERMITS_API='1000/day'
DRF_THROTTLE_RATE_PERMITS_DETAILS_API='1000/day'
DRF_THROTTLE_RATE_EVENTS_API='100000/day'
DRF_THROTTLE_RATE_SEARCH_API='1000/day'
DRF_THROTTLE_RATE_AGENDA_API='100000/day'
# Only enable this option on local network where a secured SSO controls the network access
# Please refer to https://docs.djangoproject.com/en/4.0/howto/auth-remote-user/ for more informations
ALLOW_REMOTE_USER_AUTH=False
LOCATIONS_SEARCH_API="https://api3.geo.admin.ch/rest/services/api/SearchServer"
LOCATIONS_SEARCH_API_DETAILS="https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bfs.gebaeude_wohnungs_register/"
# Local directory on docker host for temporary storage of archive folders
ARCHIVE_DIR=
# Isolated network for print service
# This has to be unique for multiple instance on same docker host
ISOLATED_NETWORK_NAME=geocity_isolated_1
# IBAN for user profile, true will show in submission detail and section author
Expand All @@ -85,3 +89,13 @@ OAUTH2_PKCE_REQUIRED=false
# Available payment processor. Comma-separated values.
PAYMENT_CURRENCY=CHF
PAYMENT_PROCESSING_TEST_ENVIRONMENT=true
# Used to convert dates to the correct UTC, in hours. Choose a value between -12 and +14 (has to be integer)
LOCAL_TIME_ZONE_UTC=+1
# Use "localhost" in local
SITE_DOMAIN=None
# Use thumbor service to resize images (used by Agenda module)
USE_THUMBOR=false
# URL of the thumbor service to use
# For dockerized thumbor service not exposed over the Internet, attache Geocity to its network with this override on top of this file:
# COMPOSE_FILE=docker-compose.yml:docker-compose.thumbor.yml
THUMBOR_SERVICE_URL="http://nginx-proxy"
1 change: 0 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ services:
# For dev, set the temp folder in the main code directory, for convenience
- ./_dev_volumes/private_documents:/private_documents
- ./_dev_volumes/archive:/archive
- static_root:/static_map/geocity-wc-map/
depends_on:
- "postgres"
ports:
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.thumbor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Simple override in order to setup network for using thumbor image service
volumes:
static_root:

services:
web: # Name of this container should not be changed
networks:
- thumbor_network
networks:
# Use this network to communicate with thumbor image resize service
# More information here: https://gitlab.com/geocity/thumbor-service
thumbor_network:
external: true
10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
volumes:
- ${PRIVATE_DOCUMENTS_DIR}:/private_documents
- ${ARCHIVE_DIR}:/archive
- static_root:/static_root/geocity-wc-map/
- static_root:/external_statics
# to allow to spawn new QGIS containers
- /var/run/docker.sock:/var/run/docker.sock
environment:
Expand Down Expand Up @@ -62,6 +62,7 @@ services:
DRF_THROTTLE_RATE_PERMITS_DETAILS_API:
DRF_THROTTLE_RATE_EVENTS_API:
DRF_THROTTLE_RATE_SEARCH_API:
DRF_THROTTLE_RATE_AGENDA_API:
ALLOW_REMOTE_USER_AUTH:
LOCATIONS_SEARCH_API:
LOCATIONS_SEARCH_API_DETAILS:
Expand All @@ -70,6 +71,10 @@ services:
AUTHOR_IBAN_VISIBLE:
PAYMENT_PROCESSING_TEST_ENVIRONMENT:
PAYMENT_CURRENCY:
LOCAL_TIME_ZONE_UTC:
SITE_DOMAIN:
USE_THUMBOR:
THUMBOR_SERVICE_URL:
ports:
- "${DJANGO_DOCKER_PORT}:9000"
networks:
Expand Down Expand Up @@ -103,9 +108,8 @@ services:
image: external_statics
build:
context: services/external_statics
working_dir: /app/geocity-wc-map
volumes:
- static_root:/app/geocity-wc-map/dist/
- static_root:/app/

networks:
# Use this for containers that should only be able to communicate with Django
Expand Down
2 changes: 1 addition & 1 deletion geocity/apps/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<li>
<b>Possibilité de refuser de fournir les données et les conséquences :</b><br>
<i>
ex: En cas de refus de fournir les données financières, aucun remoursement ne pourra être effectué.
ex: En cas de refus de fournir les données financières, aucun remboursement ne pourra être effectué.
</i>
</li>
</ul>
Expand Down
24 changes: 24 additions & 0 deletions geocity/apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@

from .fields import AdministrativeEntityFileField

AGENDA_PUBLIC_TYPE_CHOICES = (
(
True,
_("Visible"),
),
(
False,
_("Masqué"),
),
)


BOOLEAN_CHOICES = (
(
True,
_("Oui"),
),
(
False,
_("Non"),
),
)


# Controls who can fill each Form. Anonymous forms can be filled by anyone
PUBLIC_TYPE_CHOICES = (
(
Expand Down
43 changes: 43 additions & 0 deletions geocity/apps/api/pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response

from geocity.apps.api.serializers import get_available_filters_for_agenda_as_json


class CustomPagination(PageNumberPagination):
def get_paginated_response(self, data):
return Response(
{
"links": {
"next": self.get_next_link(),
"previous": self.get_previous_link(),
},
"numberReturned": self.page.paginator.count,
"numberMatched": len(data),
**data,
}
)


class AgendaResultsSetPagination(PageNumberPagination):
page_size = 20
page_size_query_param = "page_size"
max_page_size = 100

def get_paginated_response(self, data):
domain = self.request.GET.get("domain")
agenda_filters = get_available_filters_for_agenda_as_json(domain)
return Response(
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {"name": "urn:ogc:def:crs:EPSG::2056"},
},
"next": self.get_next_link(),
"previous": self.get_previous_link(),
"count": self.page.paginator.count,
"features": data,
"filters": agenda_filters,
}
)
Loading

0 comments on commit 88360d5

Please sign in to comment.