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

from ..models import *

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

import django
django.setup()

# class GroupRelation(models.Model):
#     user = models.ForeignKey(User)
#     group = models.ForeignKey(Group)
#     time = models.DateTimeField()

def insertGroupRelation(**groupRelation):
    g = GroupRelation(**groupRelation)
    g.save()


def deleteGroupRelation(id):
    GroupRelation.objects.get(id=id).delete()

#deleteUser(7)

def getGroupRelationById(id):
    return GroupRelation.objects.get(id=id)



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


def updateGroupRelation(**kw):
    GroupRelation.objects.filter(id=kw['id']).update(**kw)