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

Release/3.7.0 #1012

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e3a9fa5
change base image, user gdal from gchr
monodo Apr 17, 2024
505251d
Merge tag 'v3.6.4' into develop
AlexandreJunod Apr 22, 2024
fa2720d
Generate transaction PDF only if transaction is authorized (#988)
rbovard Apr 25, 2024
2176dd1
add new agenda_domain field
AlexandreJunod May 3, 2024
d054abf
fix unique field
AlexandreJunod May 3, 2024
23272ac
fix model and adapt tests
AlexandreJunod May 3, 2024
c0886e8
fix 'ReturnDict' object has no attribute 'move_to_end' (#989)
AlexandreJunod May 7, 2024
33f901d
Remove extra line in template
rbovard May 7, 2024
f1725a6
Add message when editing awaiting supplement submission
rbovard May 7, 2024
a66cb3b
Merge branch 'develop' into feature/change_base_image_gdal_3.8.3
AlexandreJunod May 7, 2024
9bf8bb3
Merge pull request #992 from yverdon/feature/yc-1199
rbovard May 8, 2024
3cee35c
Apply CKEditor migration to payment reports
rbovard May 8, 2024
bf08408
allow configuration in .env
monodo May 15, 2024
8b76b49
back check for additional file extension restrictions
monodo May 21, 2024
9660d56
fix about link (#995)
monodo May 21, 2024
aff04ad
YC-598: Handle special chars in email sender name (#993)
rbovard May 21, 2024
fb29854
Merge tag 'v3.6.5' into develop
AlexandreJunod May 22, 2024
3eb474c
Merge branch 'develop' of https://github.com/yverdon/geocity into dev…
AlexandreJunod May 22, 2024
fed039b
Merge pull request #994 from yverdon/feature/apply-ckeditor-migration…
AlexandreJunod May 22, 2024
15db952
add comment
AlexandreJunod May 22, 2024
397cf8c
use existant function, DRY
AlexandreJunod May 24, 2024
1f413ac
Merge pull request #998 from yverdon/feature/CSRF_TRUSTED_ORIGINS
AlexandreJunod May 24, 2024
7022fad
Merge branch 'develop' into feature/change_base_image_gdal_3.8.3
AlexandreJunod May 24, 2024
4a809a6
[RM-1] interpret end of line for validation and amend_fields comments…
AlexandreJunod May 28, 2024
cc2f359
Merge pull request #1000 from yverdon/feature/backend_check_for_file_…
AlexandreJunod May 28, 2024
507736b
Merge pull request #990 from yverdon/feature/yc-1193
AlexandreJunod May 28, 2024
f2fcbe4
remove filters when accessing to one specific event
AlexandreJunod May 28, 2024
a6ab80d
force download (#1002)
monodo May 28, 2024
2eacf14
set validation for geom field (#1005)
monodo May 28, 2024
e554f4d
[YC-1205] fix call to url that does not exist (#1003)
monodo May 28, 2024
1d3405c
[YC-1206] fix error on ftsearch (#1004)
monodo May 28, 2024
d341f13
upgrade to jazzmin 3 (#1008)
monodo May 29, 2024
3d2bceb
Feature/fix admin field order (#1011)
monodo May 29, 2024
077ba08
Merge pull request #1006 from yverdon/feature/fix_agenda_event_details
AlexandreJunod May 29, 2024
7e8928a
Merge pull request #984 from yverdon/feature/change_base_image_gdal_3…
AlexandreJunod May 29, 2024
5b84e87
fix entrypoint
AlexandreJunod May 29, 2024
16a1e6b
default CSRF_TRUSTED_ORIGINS value if not given in env
AlexandreJunod May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ USE_THUMBOR=false
# 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"
# https://docs.djangoproject.com/en/5.0/ref/settings/#csrf-trusted-origins
CSRF_TRUSTED_ORIGINS=https://yoursite.geocity
29 changes: 28 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
FROM sitdocker/geocity-base:v2.1.5
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.3

RUN apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --fix-missing \
--no-install-recommends \
build-essential \
gettext \
python3-pip \
libcairo2-dev \
poppler-utils \
python3-dev \
python3-setuptools \
python3-wheel \
python3-cffi \
libcairo2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libgdk-pixbuf2.0-0 \
libffi-dev \
shared-mime-info \
tzdata \
&& ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata

# Update C env vars so compiler can find gdal
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
ENV C_INCLUDE_PATH=/usr/include/gdal
ENV PYTHONUNBUFFERED 1

ARG ENV

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Geocity - build your (geo)-forms easily! ![Geocity CI](https://github.com/yverdon/geocity/workflows/Geocity%20CI/badge.svg?branch=main)

**[What is Geocity ?](https://geocity.ch/about)**
**[What is Geocity ?](https://geocity-asso.ch)**

**[Features and user guide](https://github.com/yverdon/geocity/wiki)**

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ volumes:

services:
web: # Name of this container should not be changed
image: gms_web
image: geocity
restart: unless-stopped
build:
context: ./
Expand Down Expand Up @@ -79,6 +79,7 @@ services:
SITE_DOMAIN:
USE_THUMBOR:
THUMBOR_SERVICE_URL:
CSRF_TRUSTED_ORIGINS:
ports:
- "${DJANGO_DOCKER_PORT}:9000"
networks:
Expand Down
11 changes: 5 additions & 6 deletions geocity/apps/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ class AdministrativeEntityAdmin(IntegratorFilterMixin, admin.ModelAdmin):
{
"fields": (
"name",
"agenda_domain",
"agenda_name",
"tags",
"ofs_id",
Expand Down Expand Up @@ -1011,13 +1012,11 @@ def sortable_str(self, obj):

@admin.display(boolean=True)
def has_background_image(self, obj):
try:
return obj.background_image.url is not None
except ValueError:
return False
return True if obj.background_image.name else False

has_background_image.admin_order_field = "background_image"
has_background_image.short_description = "Image de fond"
if has_background_image:
has_background_image.admin_order_field = "background_image"
has_background_image.short_description = "Image de fond"


# Inline for base Django Site
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.11 on 2024-05-03 13:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0018_administrativeentity_agenda_name_and_more"),
]

operations = [
migrations.AddField(
model_name="administrativeentity",
name="agenda_domain",
field=models.CharField(
blank=True,
help_text="Utilisé afin de sélectionner les agendas visible dans agenda-embed",
max_length=128,
verbose_name="Domaine de l'agenda",
),
),
]
20 changes: 20 additions & 0 deletions geocity/apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ def associated_to_user(self, user):

class AdministrativeEntity(models.Model):
name = models.CharField(_("name"), max_length=128)
agenda_domain = models.CharField(
_("Domaine de l'agenda"),
help_text=_(
"Utilisé afin de sélectionner les agendas visible dans agenda-embed"
),
max_length=128,
blank=True,
)
agenda_name = models.CharField(
_("Nom dans l'api agenda"),
help_text=_("Nom visible dans le filtre de l'agenda"),
Expand Down Expand Up @@ -442,6 +450,18 @@ def clean(self):
}
)

# Unique constraint for agenda_domain
# Cannot be used on model, because None is also subject to the constraint (blank=True)
if self.agenda_domain:
if (
AdministrativeEntity.objects.exclude(pk=self.pk)
.filter(agenda_domain=self.agenda_domain)
.exists()
):
raise ValidationError(
{"agenda_domain": _("Le domaine de l'agenda doit être unique.")}
)

if (
not self.is_single_form_submissions
and Form.objects.filter(
Expand Down
2 changes: 1 addition & 1 deletion geocity/apps/accounts/templates/account/lockout.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h3>{% translate "Votre compte a été verrouillé par mesure de sécurité. Mer
<small>
&copy; {% now "Y" %} Geocity
&nbsp;|&nbsp;
<a href="https://geocity.ch/about" target="_blank" rel="noreferrer">{% translate "A propos" %}</a>
<a href="https://geocity-asso.ch" target="_blank" rel="noreferrer">{% translate "A propos" %}</a>
{% if config.CONTACT_URL %}
&nbsp;|&nbsp;
<a href="{{ config.CONTACT_URL }}" target="_blank" rel="noreferrer">{% translate "Contact" %}</a>
Expand Down
8 changes: 3 additions & 5 deletions geocity/apps/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
check_mandatory_2FA,
permanent_user_required,
)
from geocity.fields import PrivateFileSystemStorage, PublicFileSystemStorage
from geocity.apps.submissions import services
from geocity.fields import PublicFileSystemStorage

from . import forms, models
from .users import is_2FA_mandatory
Expand Down Expand Up @@ -396,11 +397,8 @@ def administrative_entity_file_download(request, path):
Only allows logged user to download administrative entity files
"""

mime_type, encoding = mimetypes.guess_type(path)
storage = PrivateFileSystemStorage()

try:
return StreamingHttpResponse(storage.open(path), content_type=mime_type)
return services.download_file(path)
except IOError:
raise Http404

Expand Down
2 changes: 1 addition & 1 deletion geocity/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ def get_available_filters_for_agenda_as_qs(domains):

entity = (
AdministrativeEntity.objects.filter(
tags__name=domain,
agenda_domain=domain,
forms__agenda_visible=True,
)
.distinct()
Expand Down
8 changes: 6 additions & 2 deletions geocity/apps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,19 @@ def get_queryset(self):
# Filter domain (administrative_entity) to permit sites to filter on their own domain (e.g.: sports, culture)
domains = None

# Dont filter with other conditions, when trying to access to event details
# Still possible to put after a domain_filter later, if we return it in agenda-embed
if "pk" in self.kwargs:
return submissions

if "domain_filter" in query_params:
domain_filter = query_params.getlist("domain_filter")
entities = AdministrativeEntity.objects.filter(id__in=domain_filter)
submissions = get_agenda_submissions(entities, submissions)

elif "domain" in query_params:
domains = query_params["domain"]
domains = domains.split(",") if domains else None
entities = AdministrativeEntity.objects.filter(tags__name__in=domains)
entities = AdministrativeEntity.objects.filter(agenda_domain__in=domains)
submissions = get_agenda_submissions(entities, submissions)

if "starts_at" in query_params:
Expand Down
36 changes: 33 additions & 3 deletions geocity/apps/core/static/css/admin/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,37 @@
overflow-x: auto;
}

/*Reduce select2 field width so that CRUD button remain visible*/
tr .select2 {
width: 70% !important;
/* tweak admin-sortable2 for jazzmin compatibility with tabular inlines */
/* Used in "1.4 Formulaires", tab "Champs" */

fieldset.module.sortable tbody tr.form-row {
padding: 20px 0px 10px 0px; /* top right bottom left*/
border-bottom: 1px dashed #c7c7c7;
}

fieldset.module.sortable tbody .original {
width: 50px;
text-align: center;
}

fieldset.module.sortable td.original p {
width: 45px !important;
}

fieldset.module.sortable tbody .field-field {
width: 650px;
}

fieldset.module.sortable tbody .delete {
width: 50px; /* width of div. (thead .original - tbody.original - tbody .field-field)*/
position: relative; /* used to move 50 px left */
left: 75px;
}

fieldset.module.sortable thead .original {
width: 750px;
}

fieldset.module.sortable thead .column-field {
display: none;
}
2 changes: 1 addition & 1 deletion geocity/apps/core/templates/base_generic.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
<small>
&copy; {% now "Y" %} Geocity
&nbsp;|&nbsp;
<a href="https://geocity.ch/about" target="_blank" rel="noreferrer">{% translate "A propos" %}</a>
<a href="https://geocity-asso.ch" target="_blank" rel="noreferrer">{% translate "A propos" %}</a>
{% if config.CONTACT_URL %}
&nbsp;|&nbsp;
<a href="{{ config.CONTACT_URL }}" target="_blank" rel="noreferrer">{% translate "Contact" %}</a>
Expand Down
23 changes: 19 additions & 4 deletions geocity/apps/forms/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import string

import django.db.models
from adminsortable2.admin import SortableAdminMixin, SortableInlineAdminMixin
from adminsortable2.admin import SortableAdminMixin, SortableTabularInline
from constance import config
from django import forms
from django.contrib import admin
Expand Down Expand Up @@ -178,8 +178,7 @@ def save(self, *args, **kwargs):
return super().save(*args, **kwargs)


# TODO: enable drag and drop for inline reorder
class FormFieldInline(admin.TabularInline, SortableInlineAdminMixin):
class FormFieldInline(SortableTabularInline):
model = models.FormField
extra = 2
verbose_name = _("Champ")
Expand All @@ -198,7 +197,7 @@ class Media:
css = {"all": ("css/admin/admin.css",)}


class FormPricesInline(admin.TabularInline, SortableInlineAdminMixin):
class FormPricesInline(admin.TabularInline):
model = models.Form.prices.through
extra = 1
verbose_name = _("Tarif")
Expand Down Expand Up @@ -556,6 +555,22 @@ def clean_maximum_date(self):

return maximum_date

def clean_map_widget_configuration(self):
selected_input_type = self.cleaned_data.get("input_type")
map_widget_configuration = self.cleaned_data.get("map_widget_configuration")

if (
selected_input_type == models.Field.INPUT_TYPE_GEOM
and not map_widget_configuration
):
raise forms.ValidationError(
_(
"Vous devez obligatoirement sélectionner une configuration de carte avancée."
)
)

return map_widget_configuration

class Media:
js = ("js/admin/form_field.js",)

Expand Down
3 changes: 3 additions & 0 deletions geocity/apps/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ class Meta:
verbose_name_plural = _("Champs du formulaire")
ordering = ("order",)

def __str__(self):
return str(self.order)


# Input types
INPUT_TYPE_ADDRESS = "address"
Expand Down
Loading
Loading