util.py 310 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, true)", [str(user.id)])

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