Files
WYGIWYH/app/apps/api/tests
Asish Kumar d9142f6872 fix(splits): let events with expenses or payments be deleted
Deleting a split event failed with a server error as soon as it had an
expense or a payment, from the event page and from the API alike
(DELETE /api/splits/events/{id}/). Deleting the event cascades to its
participants, and the expenses, shares and payments pointing at them
used on_delete=PROTECT, which refuses even when those rows are being
deleted with the same event. Only empty events could be removed, and an
admin couldn't delete a user who organized one.

- The participant foreign keys on expenses, shares and payments now use
  RESTRICT. A participant with expenses or payments still can't be
  deleted on their own (the people screen and the API already check
  this first), but they now go along with their event. The migration
  only changes Django's state; the database is untouched.
- Deleting an event also removes its attachments' files, as deleting an
  expense or a payment already does, so receipts aren't left behind in
  the private media folder.
2026-12-05 05:51:12 +05:30
..