Commit 5132eb49 authored by Sli's avatar Sli
Browse files

Merge branch 'elections' into 'master'

It's better to delete an object in delete

See merge request ae/Sith!140
parents 73bd8b0f 5915de96
Pipeline #1439 passed with stage
in 5 minutes and 47 seconds
...@@ -158,6 +158,7 @@ class Candidature(models.Model): ...@@ -158,6 +158,7 @@ class Candidature(models.Model):
def delete(self): def delete(self):
for vote in self.votes.all(): for vote in self.votes.all():
vote.delete() vote.delete()
super(Candidature, self).delete()
def can_be_edited_by(self, user): def can_be_edited_by(self, user):
return (user == self.user) or user.can_edit(self.role.election) return (user == self.user) or user.can_edit(self.role.election)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment