Merge branch 'elections' into 'master'

It's better to delete an object in delete

See merge request ae/Sith!140
This commit is contained in:
Antoine Bartuccio 2017-12-12 14:58:02 +01:00
commit 5132eb49e4

View File

@ -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)