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

from ..models import *

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

import django
django.setup()

# class LocationMessage(models.Model):
#     message = models.ForeignKey(Message,null=True)
#     content = models.TextField()

def insertLocationMessage(**locationMessage):
    l = LocationMessage(**locationMessage)
    l.save()


def deleteLocationMessage(id):
    LocationMessage.objects.get(id=id).delete()

#deleteUser(7)

def getLocationMessageById(id):
    return LocationMessage.objects.get(id=id)



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


def updateLocationMessage(**kw):
    LocationMessage.objects.filter(id=kw['id']).update(**kw)