util.py 311 Bytes
#-*- coding:utf-8 -*-

from django.db import connection
from django.contrib.auth.models import User

def set_history(user):
  cursor = connection.cursor()
  cursor.execute("SELECT set_config('var.user_id', %s, false)", [str(user.id)])

def bot_history():
  set_history(User.objects.get(username=u'Kuźniobot'))