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

Bug deleting cycles with analysis or AT events #4773

Open
perryr16 opened this issue Sep 5, 2024 · 0 comments
Open

Bug deleting cycles with analysis or AT events #4773

perryr16 opened this issue Sep 5, 2024 · 0 comments
Assignees

Comments

@perryr16
Copy link
Contributor

perryr16 commented Sep 5, 2024

The relation between Event and Cycle is incorrectly set. Currently, the Event is protected when a Cycle is deleted.

class Event(TimeStampedModel):
    property = models.ForeignKey(Property, on_delete=models.CASCADE, related_name="events")
    cycle = models.ForeignKey(Cycle, on_delete=models.PROTECT)

This relationship causes a ProtectedError when attempting to delete a cycle that had Analysis or AT events.

django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'Cycle' because they are referenced through protected foreign keys: 'Event.cycle'."

This should be changed to on_delete=models.CASCADE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready to Deploy
Development

No branches or pull requests

1 participant