__author__ = 'user'
# -*- coding: utf-8 -*-

from ..models import *

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zzc.settings")

import django
django.setup()


# class AddFriend(models.Model):
#     user_from = models.ForeignKey(User)
#     user_to_id = models.IntegerField()
#     time = models.DateTimeField()


def insertAddFriend(**addFriend):
    a = AddFriend(**addFriend)
    a.save()


def deleteAddFriend(id):
    AddFriend.objects.get(id=id).delete()

#deleteUser(7)

def getAddFriendById(id):
    return AddFriend.objects.get(id=id)



# def getUserByCode(code):
#     return User.objects.filter(code=code)


def updateAddFriend(**kw):
    AddFriend.objects.filter(id=kw['id']).update(**kw)