+ def save(self, *args, **kwargs):
+ if isinstance(self.awarded_count, models.expressions.ExpressionNode):
+ super(Badge, self).save(*args, **kwargs)
+ self.awarded_count = self.__class__.objects.filter(id=self.id).values_list('awarded_count', flat=True)[0]
+ else:
+ super(Badge, self).save(*args, **kwargs)