Compare commits
11 Commits
65ac5ae18e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 28d3d99754 | |||
| 78c2860cca | |||
| 2024466a48 | |||
| 72570e25c2 | |||
| a3b252c9be | |||
| b0e686245a | |||
|
|
b50c010b3b | ||
| be581675cd | |||
| c1519bab0f | |||
| 585bc60676 | |||
| b9943b7d41 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ flowbite
|
|||||||
gallery/*
|
gallery/*
|
||||||
tailwind
|
tailwind
|
||||||
whoosh_index
|
whoosh_index
|
||||||
|
databases/django
|
||||||
|
|||||||
@@ -136,6 +136,10 @@ ckeditor -> django-prose-editor
|
|||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
2.2.1
|
||||||
|
|
||||||
|
* Fix rental (view, pdf file, sending mail)
|
||||||
|
|
||||||
2.2.0
|
2.2.0
|
||||||
|
|
||||||
* Add rental
|
* Add rental
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- django-homepage
|
- django-homepage
|
||||||
volumes:
|
volumes:
|
||||||
- files-volume:/usr/src/app/files
|
- ./files:/usr/src/app/files
|
||||||
- ./gallery:/usr/src/app/files/uploads/gallery
|
- ./gallery:/usr/src/app/files/uploads/gallery
|
||||||
- ./assets:/usr/src/app/assets:ro
|
- ./assets:/usr/src/app/assets:ro
|
||||||
networks:
|
networks:
|
||||||
@@ -47,7 +47,7 @@ services:
|
|||||||
retries: 20
|
retries: 20
|
||||||
etherpad:
|
etherpad:
|
||||||
container_name: etherpad-container
|
container_name: etherpad-container
|
||||||
image: etherpad/etherpad:1.8.17
|
image: etherpad/etherpad:2.5.2
|
||||||
# ports:
|
# ports:
|
||||||
# - 9001:9001
|
# - 9001:9001
|
||||||
environment:
|
environment:
|
||||||
@@ -57,8 +57,9 @@ services:
|
|||||||
DB_NAME: etherpaddb
|
DB_NAME: etherpaddb
|
||||||
DB_USER: user
|
DB_USER: user
|
||||||
DB_PASS: "hgu"
|
DB_PASS: "hgu"
|
||||||
DB_CHARSET: utf8
|
DB_CHARSET: "utf8mb4"
|
||||||
TRUST_PROXY: false
|
TRUST_PROXY: false
|
||||||
|
AUTHENTICATION_METHOD: "apikey"
|
||||||
depends_on:
|
depends_on:
|
||||||
etherpadsql:
|
etherpadsql:
|
||||||
condition: "service_healthy"
|
condition: "service_healthy"
|
||||||
@@ -84,7 +85,8 @@ services:
|
|||||||
MYSQL_CHARSET: utf8
|
MYSQL_CHARSET: utf8
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||||
volumes:
|
volumes:
|
||||||
- mysql-volume:/docker-entrypoint-initdb.d/
|
- ./inits/django:/docker-entrypoint-initdb.d/
|
||||||
|
- ./databases/django:/var/lib/mysql:Z
|
||||||
networks:
|
networks:
|
||||||
- django-db-network
|
- django-db-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -102,7 +104,8 @@ services:
|
|||||||
MYSQL_CHARSET: utf8
|
MYSQL_CHARSET: utf8
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
|
||||||
volumes:
|
volumes:
|
||||||
- etherpad-mysql-volume:/docker-entrypoint-initdb.d/
|
- ./init/etherpad:/docker-entrypoint-initdb.d/
|
||||||
|
- ./databases/etherpad:/var/lib/mysql:Z
|
||||||
networks:
|
networks:
|
||||||
- etherpad-db-network
|
- etherpad-db-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from django.utils.version import get_version
|
from django.utils.version import get_version
|
||||||
|
|
||||||
VERSION = (2, 2, 0, "final", 0)
|
VERSION = (2, 2, 1, "final", 0)
|
||||||
BUILD = 0
|
BUILD = 0
|
||||||
|
|
||||||
__version__ = get_version(VERSION)
|
__version__ = get_version(VERSION)
|
||||||
|
|||||||
@@ -204,7 +204,12 @@ class BillAdmin(admin.ModelAdmin):
|
|||||||
actions = ["make_cleared", "make_finished"]
|
actions = ["make_cleared", "make_finished"]
|
||||||
autocomplete_fields = ["resolution"]
|
autocomplete_fields = ["resolution"]
|
||||||
list_filter = ["status", "affiliation", "payer", BillPeriodeFilter]
|
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
|
show_facets = admin.ShowFacets.ALWAYS
|
||||||
ordering = ["-id"]
|
ordering = ["-id"]
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from django import forms
|
|||||||
from django.core.validators import ValidationError
|
from django.core.validators import ValidationError
|
||||||
from django.db.models import Count, Q
|
from django.db.models import Count, Q
|
||||||
from django.forms import DateInput
|
from django.forms import DateInput
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from members.models import Member
|
from members.models import Member
|
||||||
|
|
||||||
@@ -412,7 +413,7 @@ class BillAdminForm(forms.ModelForm):
|
|||||||
self.fields["resolution"].queryset = self.fields["resolution"].queryset.filter(
|
self.fields["resolution"].queryset = self.fields["resolution"].queryset.filter(
|
||||||
(
|
(
|
||||||
Q(option=Resolution.Option.FINANCE)
|
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)
|
| Q(option=Resolution.Option.PERMANENT)
|
||||||
)
|
)
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
import datetime
|
|
||||||
import io
|
import io
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
|
from django.utils import timezone
|
||||||
from pypdf import PdfReader, PdfWriter
|
from pypdf import PdfReader, PdfWriter
|
||||||
from pypdf.constants import FieldDictionaryAttributes as FA # noqa: N814
|
from pypdf.constants import FieldDictionaryAttributes as FA # noqa: N814
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ def generate_pdf(wiref):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Get budget year
|
# Get budget year
|
||||||
today = datetime.datetime.now(tz=datetime.UTC).date()
|
today = timezone.now().date()
|
||||||
if today.month < 7:
|
if today.month < 7:
|
||||||
budget_year = f"{today.year - 1}-{today.year}"
|
budget_year = f"{today.year - 1}-{today.year}"
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class EventForm(PostForm):
|
|||||||
"image": "Verwendbare Formate: Bildformate",
|
"image": "Verwendbare Formate: Bildformate",
|
||||||
"is_pinned": (
|
"is_pinned": (
|
||||||
"Dieses Event soll als erstes auf der Startseite angeheftet werden und sich "
|
"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."
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
import calendar
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Case, Q, When
|
from django.db.models import Case, Q, When
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from .choices import PostType, Status
|
from .choices import PostType, Status
|
||||||
|
|
||||||
@@ -81,21 +83,26 @@ class ArticleManager(PublishedManager, models.Manager):
|
|||||||
|
|
||||||
def pinned(self, public=True):
|
def pinned(self, public=True):
|
||||||
# Get date for pinned news that is max 1 month old.
|
# Get date for pinned news that is max 1 month old.
|
||||||
post_date = datetime.datetime.now(tz=datetime.UTC).date()
|
post_date = timezone.now().date()
|
||||||
__month = post_date.month
|
_day = post_date.day
|
||||||
__year = post_date.year
|
_month = post_date.month
|
||||||
|
_year = post_date.year
|
||||||
|
|
||||||
if __month != 1:
|
if _month != 1:
|
||||||
__month -= 1
|
_month -= 1
|
||||||
else:
|
else:
|
||||||
# If the current month is January, you get the date from December of previous year.
|
# If the current month is January, you get the date from December of previous year.
|
||||||
__month = 12
|
_month = 12
|
||||||
__year -= 1
|
_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.
|
# 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 (
|
return (
|
||||||
self.published(public)
|
self.published(public)
|
||||||
@@ -145,7 +152,7 @@ class AllEventManager(PublishedManager, models.Manager):
|
|||||||
return qs.order_by("-date")
|
return qs.order_by("-date")
|
||||||
|
|
||||||
def future_events(self, public=True):
|
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)
|
qs = self.published(public).filter(event_start__gt=date_today)
|
||||||
return qs.reverse()
|
return qs.reverse()
|
||||||
|
|
||||||
@@ -166,12 +173,12 @@ class EventManager(PublishedManager, models.Manager):
|
|||||||
return qs.order_by("-date")
|
return qs.order_by("-date")
|
||||||
|
|
||||||
def future_events(self, public=True):
|
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)
|
qs = self.published(public).filter(event_start__gt=date_today)
|
||||||
return qs.reverse()
|
return qs.reverse()
|
||||||
|
|
||||||
def past_events(self, public=True):
|
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)
|
qs = self.published(public).filter(event_start__lt=date_today)
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
@@ -191,11 +198,11 @@ class FetMeetingManager(PublishedManager, models.Manager):
|
|||||||
return qs.order_by("-date")
|
return qs.order_by("-date")
|
||||||
|
|
||||||
def future_events(self):
|
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)
|
qs = self.published().filter(event_start__gt=date_today)
|
||||||
return qs.reverse()
|
return qs.reverse()
|
||||||
|
|
||||||
def past_events(self):
|
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)
|
qs = self.published().filter(event_start__lt=date_today)
|
||||||
return qs
|
return qs
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ class RentalAdminForm(forms.ModelForm):
|
|||||||
|
|
||||||
widgets = {"rentalitems": forms.CheckboxSelectMultiple()}
|
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 RentalItemAdminForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
18
fet2020/rental/migrations/0002_rental_intern.py
Normal file
18
fet2020/rental/migrations/0002_rental_intern.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -6,6 +6,7 @@ from django.db.models import Q
|
|||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils import timezone
|
||||||
from django.views.generic import ListView, TemplateView
|
from django.views.generic import ListView, TemplateView
|
||||||
from django.views.generic.detail import DetailView
|
from django.views.generic.detail import DetailView
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
@@ -64,7 +65,7 @@ def _get_display_period(view_type: str, period: str) -> date:
|
|||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Get first day of the current week
|
# 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())
|
display_date = today - datetime.timedelta(days=today.weekday())
|
||||||
|
|
||||||
# Handle month view
|
# Handle month view
|
||||||
@@ -76,7 +77,7 @@ def _get_display_period(view_type: str, period: str) -> date:
|
|||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Get the first day of the current month
|
# 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
|
return display_date
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ class RentalListView(ListView):
|
|||||||
context["week_num"] = week_num
|
context["week_num"] = week_num
|
||||||
|
|
||||||
# Get the current date for the calendar
|
# 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
|
# Add rental items to the context for the filter
|
||||||
context["rentalitems"] = RentalItem.objects.all()
|
context["rentalitems"] = RentalItem.objects.all()
|
||||||
@@ -234,7 +235,7 @@ class RentalCreateView(CreateView):
|
|||||||
selected_items = sorted(items, key=lambda x: x.name.lower())
|
selected_items = sorted(items, key=lambda x: x.name.lower())
|
||||||
|
|
||||||
for i in range(0, len(selected_items), RENTAL_ITEMS_MAX):
|
for i in range(0, len(selected_items), RENTAL_ITEMS_MAX):
|
||||||
batch = selected_items[i:i + RENTAL_ITEMS_MAX]
|
batch = selected_items[i : i + RENTAL_ITEMS_MAX]
|
||||||
|
|
||||||
# Clone base_rental — copying all its field values
|
# Clone base_rental — copying all its field values
|
||||||
new_rental = Rental.objects.create(
|
new_rental = Rental.objects.create(
|
||||||
@@ -266,6 +267,7 @@ class RentalCreateView(CreateView):
|
|||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
return reverse("rental:rental_create_done")
|
return reverse("rental:rental_create_done")
|
||||||
|
|
||||||
|
|
||||||
class RentalCreateDoneView(TemplateView):
|
class RentalCreateDoneView(TemplateView):
|
||||||
template_name = "rental/create_done.html"
|
template_name = "rental/create_done.html"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user