From 643176485804898e7852dfedbf190d60c66832cc Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Fri, 20 Jun 2014 08:57:33 +0200 Subject: [PATCH] EventParticipation: Bugfix in save() method --- eventplanner/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eventplanner/models.py b/eventplanner/models.py index 4b022e1..10eed04 100644 --- a/eventplanner/models.py +++ b/eventplanner/models.py @@ -133,9 +133,13 @@ class EventParticipation( models.Model ): return self.user.username def save( self, *args, **kwargs ): - prev = EventParticipation.objects.get( event = self.event, user = self.user ) - if prev.status != self.status or prev.comment != self.comment: + prev = EventParticipation.objects.filter( event = self.event, user = self.user ) + if len(prev) == 0: super(EventParticipation,self).save( *args,**kwargs) + else: + prev = prev[0] + if prev.status != self.status or prev.comment != self.comment: + super(EventParticipation,self).save( *args,**kwargs) @staticmethod