- super(FlaggedItem, self).save(*args, **kwargs)
- if self._is_new:
- self._update_post_flag_count(1)
+ 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)
+
+
+ class Meta:
+ app_label = 'forum'
+
+
+class Award(models.Model):
+ user = models.ForeignKey(User)
+ badge = models.ForeignKey('Badge', related_name="awards")
+ node = models.ForeignKey(Node, null=True)