Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 10 additions & 4 deletions src/onegov/org/locale/de_CH/LC_MESSAGES/onegov.org.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2025-07-16 13:05+0200\n"
"POT-Creation-Date: 2025-07-17 14:55+0200\n"
"PO-Revision-Date: 2022-03-15 10:21+0100\n"
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -1179,8 +1179,8 @@ msgstr "Nach Beschreibung"
msgid "By last change"
msgstr "Nach Zeitpunkt der letzten Änderung"

msgid "Portrait"
msgstr "Portrait"
msgid "Agenda Items"
msgstr "Traktanden"

msgid "Used in the overview and the e-mail subject"
msgstr "Wird in der Übersicht und als E-Mail Subjekt verwendet"
Expand Down Expand Up @@ -3429,6 +3429,9 @@ msgstr "Letztes Jahr"
msgid "Older"
msgstr "Älter"

msgid "Meeting"
msgstr "Sitzung"

msgid "Do you really want to delete this note?"
msgstr "Möchten Sie diese Notiz wirklich löschen?"

Expand Down Expand Up @@ -3655,8 +3658,8 @@ msgstr "Reservationen absagen"
msgid "Reject all with message"
msgstr "Alle absagen mit Kommentar"

#.
#. Used in sentence: "${event} published."
#.
msgid "Event"
msgstr "Veranstaltung"

Expand Down Expand Up @@ -7262,6 +7265,9 @@ msgstr "Der Benutzer wurde erfolgreich erstellt"
msgid "Please enter your e-mail address in order to continue"
msgstr "Bitte geben Sie ihre E-Mail Adresse ein um fortzufahren"

#~ msgid "Portrait"
#~ msgstr "Portrait"

#~ msgid "Please note that this page has subpages which will also be deleted!"
#~ msgstr ""
#~ "Bitte beachten Sie dass die Unterthemen dieses Themas ebenfalls gelöscht "
Expand Down
18 changes: 12 additions & 6 deletions src/onegov/org/locale/fr_CH/LC_MESSAGES/onegov.org.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2025-07-16 13:05+0200\n"
"POT-Creation-Date: 2025-07-17 14:55+0200\n"
"PO-Revision-Date: 2022-03-15 10:50+0100\n"
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n"
"Language-Team: French\n"
Expand Down Expand Up @@ -1178,8 +1178,8 @@ msgstr "Par légende"
msgid "By last change"
msgstr "Par date de dernière modification"

msgid "Portrait"
msgstr "Portrait"
msgid "Agenda Items"
msgstr "Éléments d'agenda"

msgid "Used in the overview and the e-mail subject"
msgstr "Utilisé dans l'aperçu et le sujet de l'e-mail"
Expand Down Expand Up @@ -3435,6 +3435,9 @@ msgstr "L'an dernier"
msgid "Older"
msgstr "Plus âgés"

msgid "Meeting"
msgstr "Réunion"

msgid "Do you really want to delete this note?"
msgstr "Voulez-vous vraiment supprimer cette note ?"

Expand Down Expand Up @@ -3661,8 +3664,8 @@ msgstr "Refuser les réservations"
msgid "Reject all with message"
msgstr "Tout refuser avec message"

#.
#. Used in sentence: "${event} published."
#.
msgid "Event"
msgstr "Événement"

Expand Down Expand Up @@ -4054,8 +4057,8 @@ msgid ""
"filled-out form."
msgstr ""
"Veuillez vérifier vos données et appuyez sur « Compléter » pour finaliser le "
"processus. S'il y a quelque chose que vous souhaitez modifier, cliquez sur "
"« Modifier » pour retourner sur le formulaire complété."
"processus. S'il y a quelque chose que vous souhaitez modifier, cliquez sur « "
"Modifier » pour retourner sur le formulaire complété."

msgid ""
"The image shown in the list view is a square. To have your image shown fully "
Expand Down Expand Up @@ -7274,6 +7277,9 @@ msgstr "L'utilisateur a bien été créé"
msgid "Please enter your e-mail address in order to continue"
msgstr "Veuillez saisir votre adresse e-mail pour continuer"

#~ msgid "Portrait"
#~ msgstr "Portrait"

#~ msgid "Please note that this page has subpages which will also be deleted!"
#~ msgstr ""
#~ "Veuillez noter que cette page contient des sous-pages qui seront "
Expand Down
14 changes: 10 additions & 4 deletions src/onegov/org/locale/it_CH/LC_MESSAGES/onegov.org.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-07-16 13:05+0200\n"
"POT-Creation-Date: 2025-07-17 14:55+0200\n"
"PO-Revision-Date: 2022-03-15 10:52+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -1182,8 +1182,8 @@ msgstr "Per didascalia"
msgid "By last change"
msgstr "Per data dell'ultima modifica"

msgid "Portrait"
msgstr "Ritratto"
msgid "Agenda Items"
msgstr "Elementi dell'agenda"

msgid "Used in the overview and the e-mail subject"
msgstr "Utilizzato nella panoramica e nell'oggetto dell'e-mail"
Expand Down Expand Up @@ -3436,6 +3436,9 @@ msgstr "Lo scorso anno"
msgid "Older"
msgstr "Più vecchia"

msgid "Meeting"
msgstr "Riunione"

msgid "Do you really want to delete this note?"
msgstr "Vuoi davvero eliminare questa nota?"

Expand Down Expand Up @@ -3662,8 +3665,8 @@ msgstr "Rifiuta le prenotazioni"
msgid "Reject all with message"
msgstr "Rifiuta tutto con messaggio"

#.
#. Used in sentence: "${event} published."
#.
msgid "Event"
msgstr "Evento"

Expand Down Expand Up @@ -7252,6 +7255,9 @@ msgstr "Utente creato correttamente"
msgid "Please enter your e-mail address in order to continue"
msgstr "Inserisci il tuo indirizzo e-mail per continuare"

#~ msgid "Portrait"
#~ msgstr "Ritratto"

#~ msgid "Please note that this page has subpages which will also be deleted!"
#~ msgstr ""
#~ "Nota che questa pagina contiene delle sottopagine che verranno anch'esse "
Expand Down
42 changes: 39 additions & 3 deletions src/onegov/org/models/meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import uuid
from functools import cached_property

from sqlalchemy import exists, func
from sqlalchemy.ext.hybrid import hybrid_property
from sedate import utcnow

from onegov.core.collection import GenericCollection
from onegov.core.orm import Base
from onegov.core.orm.mixins import ContentMixin
Expand All @@ -15,14 +19,17 @@
from sqlalchemy import Column, Text, ForeignKey
from sqlalchemy.orm import RelationshipProperty, relationship

from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Self
if TYPE_CHECKING:
import uuid
from datetime import datetime
from markupsafe import Markup

from sqlalchemy.orm import Query
from sqlalchemy.orm import Session

from onegov.org.models import PoliticalBusiness
from onegov.org.models import MeetingItem
from sqlalchemy.orm import Query


class Meeting(
Expand Down Expand Up @@ -107,12 +114,28 @@ def title_text(self) -> str:
order_by='desc(MeetingItem.number)'
)

@hybrid_property
def past(self):
return self.start_datetime < utcnow() if self.start_datetime else False

@past.expression # type:ignore[no-redef]
def past(cls):
return exists.where(cls.start_datetime < func.now())

def __repr__(self) -> str:
return f'<Meeting {self.title}, {self.start_datetime}>'


class MeetingCollection(GenericCollection[Meeting]):

def __init__(
self,
session: Session,
past: bool | None = None
) -> None:
super().__init__(session)
self.past = past

@cached_property
def title(self) -> str:
return _('Meeting')
Expand All @@ -123,4 +146,17 @@ def model_class(self) -> type[Meeting]:

def query(self) -> Query[Meeting]:
query = super().query()
return query.order_by(self.model_class.start_datetime.desc())

Meeting = self.model_class # noqa: N806
if self.past is not None:
if self.past:
query = query.filter(Meeting.start_datetime < utcnow())
query = query.order_by(Meeting.start_datetime.desc())
else:
query = query.filter(Meeting.start_datetime >= utcnow())
query = query.order_by(Meeting.start_datetime.asc())

return query

def for_filter(self, past: bool | None = None) -> Self:
return self.__class__(self.session, past=past)
4 changes: 3 additions & 1 deletion src/onegov/org/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,11 +1282,13 @@ def get_commission(
@OrgApp.path(
model=MeetingCollection,
path='/meetings',
converters={'past': bool}
)
def get_meetings(
app: OrgApp,
past: bool = True # show past meetings by default
) -> MeetingCollection:
return MeetingCollection(app.session())
return MeetingCollection(app.session(), past)


@OrgApp.path(
Expand Down
58 changes: 44 additions & 14 deletions src/onegov/town6/locale/de_CH/LC_MESSAGES/onegov.town6.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: OneGov Cloud 1.0\n"
"POT-Creation-Date: 2025-07-16 13:06+0200\n"
"POT-Creation-Date: 2025-07-17 14:55+0200\n"
"PO-Revision-Date: 2021-03-03 16:24+0100\n"
"Last-Translator: Lukas Burkhard <lukas.burkhard@seantis.ch>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -295,6 +295,18 @@ msgstr "Ratsinformationssystem"
msgid "Meeting"
msgstr "Sitzung"

msgid "Edit"
msgstr "Bearbeiten"

msgid "Do you really want to delete this meeting?"
msgstr "Diese Sitzung wirklich löschen?"

msgid "This cannot be undone."
msgstr "Dies kann nicht rückgängig gemacht werden."

msgid "Delete meeting"
msgstr "Sitzung löschen"

msgid "Parliamentarians"
msgstr "Parlamentarierinnen und Parlamentarier"

Expand All @@ -304,15 +316,9 @@ msgstr "Parlamentarier:in"
msgid "Role (as a group member)"
msgstr "Rolle (als Fraktionsmitglied)"

msgid "Edit"
msgstr "Bearbeiten"

msgid "Do you really want to delete this parliamentarian?"
msgstr "Möchten Sie diese:n Parlamentarier:in wirklich löschen?"

msgid "This cannot be undone."
msgstr "Dies kann nicht rückgängig gemacht werden."

msgid "Delete parliamentarian"
msgstr "Parlamentarier:in löschen"

Expand Down Expand Up @@ -2478,27 +2484,57 @@ msgstr "Neue Kommission"
msgid "Your changes were saved"
msgstr "Ihre Änderungen wurden gespeichert"

msgid "The commission has been deleted."
msgstr "Die Kommission wurde gelöscht."

msgid "Sort"
msgstr "Sortieren"

msgid "Past Meetings"
msgstr "Vergangene"

msgid "Upcoming Meetings"
msgstr "Zukünftige"

msgid "Added a new meeting"
msgstr "Neue Sitzung hinzugefügt"

msgid "New meeting"
msgstr "Neue Sitzung"

msgid "Edit meeting"
msgstr "Sitzung bearbeiten"

msgid "The meeting has been deleted."
msgstr "Die Sitzung wurde gelöscht."

msgid "Added a new parliamentarian"
msgstr "Parlamentarier:in hinzugefügt"

msgid "New parliamentarian"
msgstr "Neue:r Parlamentarier:in"
msgstr "Neue/r Parlamentarier/in"

msgid "The parliamentarian has been deleted."
msgstr "Der Parlamentarier/in wurde gelöscht."

msgid "Added a new role"
msgstr "Neue Rolle hinzugefügt"

msgid "New role"
msgstr "Neue Rolle"

msgid "The parliamentarian role has been deleted."
msgstr "Die Rolle des Parlamentariers wurde gelöscht."

msgid "Added a new parliamentary group"
msgstr "Fraktion hinzugefügt"

msgid "New parliamentary group"
msgstr "Neue Fraktion"

msgid "The parliamentary group has been deleted."
msgstr "Die Fraktion wurde gelöscht."

msgid "Added a new political business"
msgstr "Politisches Geschäft hinzugefügt"

Expand Down Expand Up @@ -2713,12 +2749,6 @@ msgstr "Neue Notiz"
#~ msgid "End must be after start"
#~ msgstr "Ende muss nach dem Start liegen"

#~ msgid "Do you really want to delete this meeting?"
#~ msgstr "Diese Sitzung wirklich löschen?"

#~ msgid "Delete meeting"
#~ msgstr "Sitzung löschen"

#~ msgid "Do you really want to remove this parliamentarian?"
#~ msgstr "Diese:n Parlamentarier:in wirklich entfernen?"

Expand Down
Loading