\r
@models.permalink\r
def get_absolute_url(self):\r
- return ('badge', [], {'id': self.id, 'slug': slugify(self.name)}) \r
+ return ('badge', [], {'id': self.id, 'slug': slugify(self.name)})\r
+\r
+ def save(self, *args, **kwargs):\r
+ if isinstance(self.awarded_count, models.expressions.ExpressionNode):\r
+ super(Badge, self).save(*args, **kwargs)\r
+ self.awarded_count = self.__class__.objects.filter(id=self.id).values_list('awarded_count', flat=True)[0]\r
+ else:\r
+ super(Badge, self).save(*args, **kwargs)\r
+\r
\r
class Meta:\r
app_label = 'forum'\r