feat: derive event lifecycle status from dates and flags

Replace persisted event statuses with publication and cancellation flags, and compute public lifecycle labels from event timing and registration capacity. Keep filters, registration checks, and profile responses aligned with the derived status.
This commit is contained in:
2026-10-03 12:46:16 +03:30
parent f268c9b88a
commit 6c5fadef2f
26 changed files with 525 additions and 178 deletions

View File

@@ -117,13 +117,12 @@ def get_page_content(request, response: HttpResponse, slug: str):
page = AboutContent.objects.filter(pk=1).first()
if page is None:
raise HttpError(404, "Page content not found")
event_statuses = (Event.StatusChoices.PUBLISHED, Event.StatusChoices.COMPLETED)
years_by_label = {}
for year in page.years.prefetch_related("members", "events").all():
label = year.year_label.strip() or "سال نامشخص"
events = year.events.filter(
is_deleted=False,
status__in=event_statuses,
is_published=True,
start_time__lte=timezone.now(),
).order_by("-start_time", "-pk")
years_by_label[label] = {