11 Commits

15 changed files with 598 additions and 550 deletions

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ flowbite
gallery/*
tailwind
whoosh_index
databases/django

View File

@@ -136,6 +136,10 @@ ckeditor -> django-prose-editor
## Version History
2.2.1
* Fix rental (view, pdf file, sending mail)
2.2.0
* Add rental

Binary file not shown.

Binary file not shown.

View File

@@ -9,7 +9,7 @@ services:
depends_on:
- django-homepage
volumes:
- files-volume:/usr/src/app/files
- ./files:/usr/src/app/files
- ./gallery:/usr/src/app/files/uploads/gallery
- ./assets:/usr/src/app/assets:ro
networks:
@@ -47,7 +47,7 @@ services:
retries: 20
etherpad:
container_name: etherpad-container
image: etherpad/etherpad:1.8.17
image: etherpad/etherpad:2.5.2
# ports:
# - 9001:9001
environment:
@@ -57,8 +57,9 @@ services:
DB_NAME: etherpaddb
DB_USER: user
DB_PASS: "hgu"
DB_CHARSET: utf8
DB_CHARSET: "utf8mb4"
TRUST_PROXY: false
AUTHENTICATION_METHOD: "apikey"
depends_on:
etherpadsql:
condition: "service_healthy"
@@ -84,7 +85,8 @@ services:
MYSQL_CHARSET: utf8
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
volumes:
- mysql-volume:/docker-entrypoint-initdb.d/
- ./inits/django:/docker-entrypoint-initdb.d/
- ./databases/django:/var/lib/mysql:Z
networks:
- django-db-network
healthcheck:
@@ -102,7 +104,8 @@ services:
MYSQL_CHARSET: utf8
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
volumes:
- etherpad-mysql-volume:/docker-entrypoint-initdb.d/
- ./init/etherpad:/docker-entrypoint-initdb.d/
- ./databases/etherpad:/var/lib/mysql:Z
networks:
- etherpad-db-network
healthcheck:

View File

@@ -1,6 +1,6 @@
from django.utils.version import get_version
VERSION = (2, 2, 0, "final", 0)
VERSION = (2, 2, 1, "final", 0)
BUILD = 0
__version__ = get_version(VERSION)

View File

@@ -204,7 +204,12 @@ class BillAdmin(admin.ModelAdmin):
actions = ["make_cleared", "make_finished"]
autocomplete_fields = ["resolution"]
list_filter = ["status", "affiliation", "payer", BillPeriodeFilter]
search_fields = ["purpose", "bankdata__name"]
search_fields = [
"purpose",
"bankdata__name",
"bill_creator__firstname",
"bill_creator__surname",
]
show_facets = admin.ShowFacets.ALWAYS
ordering = ["-id"]

View File

@@ -6,6 +6,7 @@ from django import forms
from django.core.validators import ValidationError
from django.db.models import Count, Q
from django.forms import DateInput
from django.utils import timezone
from members.models import Member
@@ -412,7 +413,7 @@ class BillAdminForm(forms.ModelForm):
self.fields["resolution"].queryset = self.fields["resolution"].queryset.filter(
(
Q(option=Resolution.Option.FINANCE)
& Q(date__gt=datetime.datetime.now(tz=datetime.UTC).date() - relativedelta(years=2))
& Q(date__gt=timezone.now().date() - relativedelta(years=2))
)
| Q(option=Resolution.Option.PERMANENT)
)

View File

@@ -1,8 +1,8 @@
import datetime
import io
from pathlib import Path
from django.core.files import File
from django.utils import timezone
from pypdf import PdfReader, PdfWriter
from pypdf.constants import FieldDictionaryAttributes as FA # noqa: N814
@@ -34,7 +34,7 @@ def generate_pdf(wiref):
)
# Get budget year
today = datetime.datetime.now(tz=datetime.UTC).date()
today = timezone.now().date()
if today.month < 7:
budget_year = f"{today.year - 1}-{today.year}"
else:

View File

@@ -77,7 +77,7 @@ class EventForm(PostForm):
"image": "Verwendbare Formate: Bildformate",
"is_pinned": (
"Dieses Event soll als erstes auf der Startseite angeheftet werden und sich "
"automatisch einen Monat nach der Veröffentlichung wieder lösen."
"automatisch ein Tag nach dem Eventende wieder lösen."
),
}

View File

@@ -1,7 +1,9 @@
import calendar
import datetime
from django.db import models
from django.db.models import Case, Q, When
from django.utils import timezone
from .choices import PostType, Status
@@ -81,21 +83,26 @@ class ArticleManager(PublishedManager, models.Manager):
def pinned(self, public=True):
# Get date for pinned news that is max 1 month old.
post_date = datetime.datetime.now(tz=datetime.UTC).date()
__month = post_date.month
__year = post_date.year
post_date = timezone.now().date()
_day = post_date.day
_month = post_date.month
_year = post_date.year
if __month != 1:
__month -= 1
if _month != 1:
_month -= 1
else:
# If the current month is January, you get the date from December of previous year.
__month = 12
__year -= 1
_month = 12
_year -= 1
post_date = post_date.replace(year=__year, month=__month)
# Clamp day to last day of target month (handles 30/31 and Feb)
last_day = calendar.monthrange(_year, _month)[1]
safe_day = min(_day, last_day)
post_date = post_date.replace(year=_year, month=_month, day=safe_day)
# Get date for event posts that is max 1 day old.
event_date = datetime.datetime.now(tz=datetime.UTC).date() - datetime.timedelta(1)
event_date = timezone.now().date() - datetime.timedelta(1)
return (
self.published(public)
@@ -145,7 +152,7 @@ class AllEventManager(PublishedManager, models.Manager):
return qs.order_by("-date")
def future_events(self, public=True):
date_today = datetime.datetime.now(tz=datetime.UTC).date()
date_today = timezone.now().date()
qs = self.published(public).filter(event_start__gt=date_today)
return qs.reverse()
@@ -166,12 +173,12 @@ class EventManager(PublishedManager, models.Manager):
return qs.order_by("-date")
def future_events(self, public=True):
date_today = datetime.datetime.now(tz=datetime.UTC).date()
date_today = timezone.now().date()
qs = self.published(public).filter(event_start__gt=date_today)
return qs.reverse()
def past_events(self, public=True):
date_today = datetime.datetime.now(tz=datetime.UTC).date()
date_today = timezone.now().date()
qs = self.published(public).filter(event_start__lt=date_today)
return qs
@@ -191,11 +198,11 @@ class FetMeetingManager(PublishedManager, models.Manager):
return qs.order_by("-date")
def future_events(self):
date_today = datetime.datetime.now(tz=datetime.UTC).date()
date_today = timezone.now().date()
qs = self.published().filter(event_start__gt=date_today)
return qs.reverse()
def past_events(self):
date_today = datetime.datetime.now(tz=datetime.UTC).date()
date_today = timezone.now().date()
qs = self.published().filter(event_start__lt=date_today)
return qs

View File

@@ -51,6 +51,13 @@ class RentalAdminForm(forms.ModelForm):
widgets = {"rentalitems": forms.CheckboxSelectMultiple()}
help_texts = {
"status": (
"Wird der Status auf 'Verleih genehmigt' oder 'Verleih abgelehnt' gesetzt, wird "
"eine E-Mail gesendet."
),
}
class RentalItemAdminForm(forms.ModelForm):
class Meta:

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.7 on 2025-10-30 14:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='rental',
name='intern',
field=models.BooleanField(default=False, verbose_name='Interner Verleih'),
),
]

View File

@@ -6,6 +6,7 @@ from django.db.models import Q
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from django.utils import timezone
from django.views.generic import ListView, TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
@@ -64,7 +65,7 @@ def _get_display_period(view_type: str, period: str) -> date:
)
except Exception:
# Get first day of the current week
today = datetime.datetime.now(tz=datetime.UTC).date()
today = timezone.now().date()
display_date = today - datetime.timedelta(days=today.weekday())
# Handle month view
@@ -76,7 +77,7 @@ def _get_display_period(view_type: str, period: str) -> date:
)
except Exception:
# Get the first day of the current month
display_date = datetime.datetime.now(tz=datetime.UTC).date().replace(day=1)
display_date = timezone.now().date().replace(day=1)
return display_date
@@ -170,7 +171,7 @@ class RentalListView(ListView):
context["week_num"] = week_num
# Get the current date for the calendar
context["today"] = datetime.datetime.now(tz=datetime.UTC).date()
context["today"] = timezone.now().date()
# Add rental items to the context for the filter
context["rentalitems"] = RentalItem.objects.all()
@@ -266,6 +267,7 @@ class RentalCreateView(CreateView):
def get_success_url(self):
return reverse("rental:rental_create_done")
class RentalCreateDoneView(TemplateView):
template_name = "rental/create_done.html"