From 5915de960328f34ac8947c752e23865adb0a120c Mon Sep 17 00:00:00 2001 From: klmp200 Date: Tue, 12 Dec 2017 14:52:08 +0100 Subject: [PATCH] It's better to delete an object in delete --- election/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/election/models.py b/election/models.py index 937bca74..6d31ed0a 100644 --- a/election/models.py +++ b/election/models.py @@ -158,6 +158,7 @@ class Candidature(models.Model): def delete(self): for vote in self.votes.all(): vote.delete() + super(Candidature, self).delete() def can_be_edited_by(self, user): return (user == self.user) or user.can_edit(self.role.election)