Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vis ikke fejl ved sletning af aktiviteter med inviterede #1120

Merged
merged 5 commits into from
Oct 27, 2024

Conversation

rasmusselsmark
Copy link
Contributor

Løser #1040 (se skærmbillede med fejl på ticket)

Bemærk at pga. Django, vil der stadig stå at aktiviteten blev slettet, selvom den i realiteten ikke blev slettet:
image

Det lader dog til at være en "feature" i Django, som vi ikke umiddelbart kan gøre noget ved.

Har valideret lokalt at man godt kan slette aktiviteter uden invitationer.

Copy link

what-the-diff bot commented Oct 27, 2024

PR Summary

  • Updating Activity Administration Functions

    • The code for managing activities has been enhanced to include functions related to deletion like delete_queryset and delete_model. Now, when an activity is deleted, success or error messages are showcased, ensuring the process is more intuitive and user-friendly.
  • Migration to Alter ActivityInvite

    • The system behavior when an activity is deleted has been changed. Previously, all associated invites were also deleted (CASCADE) but the new change ensures that invites are unaffected (DO_NOTHING) when the parent activity is deleted. This alteration was established through a migration in the 0056_alter_activityinvite_activity.py file.
  • Counting Related Activity Invites and Protecting Linked Data

    • A new function, invitations, has been added to the activity.py script that counts the invitations of an activity. This addition helps provide a quantitative view of an activity's reach. Furthermore, to prevent disruption and potential data inconsistency, the activity's delete method has been overridden. It now prevents deletion of an activity if there are still participants or invites, offering an error message if attempted.
  • Preservation of Activity Invitations

    • To coincide with the above changes, the model for activity invites (activityinvite.py) has had its treatment of the activity foreign key updated. Similarly to the previous point, the on_delete option has been modified from CASCADE to DO_NOTHING, ensuring activity invitations are preserved even if the activity itself is deleted.

@rasmusselsmark rasmusselsmark changed the title Tillad ikke at slette aktiviteter med inviterede Vis ikke fejl ved sletning af aktiviteter med inviterede Oct 27, 2024
@rasmusselsmark rasmusselsmark merged commit fa02646 into master Oct 27, 2024
5 checks passed
@rasmusselsmark rasmusselsmark deleted the fix-deleting-activities-with-participants branch November 11, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants