dont try - with none

This commit is contained in:
j 2012-02-20 09:51:41 +05:30
parent 8e0b88d939
commit f8c55f57cb

View file

@ -124,7 +124,7 @@ class Event(models.Model):
self.name_find = '||' + self.name + '||'.join(self.alternativeNames) + '||'
self.defined = len(filter(None, [getattr(self, key)
for key in ('start', 'end', 'startTime', 'endTime')])) > 0
if self.defined:
if self.endTime and self.startTime:
self.durationTime = self.endTime - self.startTime
super(Event, self).save(*args, **kwargs)