award.delete()\r
\r
@classmethod\r
- def get_for(cls, user, node, badge):\r
+ def get_for(cls, user, badge, node=False):\r
try:\r
- award = Award.objects.get(user=user, node=node, badge=badge)\r
- return award.action\r
+ if node is False:\r
+ return Award.objects.get(user=user, badge=badge).action\r
+ else:\r
+ return Award.objects.get(user=user, node=node, badge=badge).action\r
except:\r
return None\r
\r
def award(cls, user, action, once=False):
if once:
node = None
+ awarded = AwardAction.get_for(user, cls.ondb)
else:
node = action.node
-
- awarded = AwardAction.get_for(user, node, cls.ondb)
+ awarded = AwardAction.get_for(user, cls.ondb, node)
if not awarded:
AwardAction(user=user, node=node, ip=action.ip).save(data=dict(badge=cls.ondb, trigger=action))
\ No newline at end of file