def incrementStat(statname,value): stats = Stat.objects(name=statname) stat = None if not stats or len(stats)<=0: stat = Stat() stat.name = statname stat.total = 0 else: stat = stats[0] stat.total = stat.total + value stat.save()
def go(request): user = request.user stats = Stat.objects() template_values = { 'stats': stats, 'user' : user, } path = os.path.join(os.path.dirname(__file__), 'templates/ideas/managestats.html') return render_to_response(path, template_values)