EventParticipation: Bugfix in save() method

This commit is contained in:
Martin Bauer 2014-06-20 08:57:33 +02:00
parent 5639c5fd82
commit 6431764858
1 changed files with 6 additions and 2 deletions

View File

@ -133,9 +133,13 @@ class EventParticipation( models.Model ):
return self.user.username return self.user.username
def save( self, *args, **kwargs ): def save( self, *args, **kwargs ):
prev = EventParticipation.objects.get( event = self.event, user = self.user ) prev = EventParticipation.objects.filter( event = self.event, user = self.user )
if prev.status != self.status or prev.comment != self.comment: if len(prev) == 0:
super(EventParticipation,self).save( *args,**kwargs) 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 @staticmethod