Beispiel #1
0
def addRandom(request):
    tm = tempMessage()
    tm.text = fake.sentence()
    tm.dislike = random.randint(0, 50)
    tm.like = random.randint(0, 50)
    tm.sending_user_link = fake.url()
    tm.sending_user_name = fake.user_name()
    tm.temperature = random.randint(-20, 50)
    tm.pub_date = datetime.datetime.now()
    tm.isactive = True
    b = tm.save()
    return HttpResponse("added")
Beispiel #2
0
def addMessage(request):

    text = request.POST['text']
    userlink = request.POST['userlink']
    username = request.POST['username']
    temperature = request.POST['temperature']

    tm = tempMessage()
    tm.text = text
    tm.dislike = 0
    tm.like = 0
    tm.sending_user_link = userlink
    tm.sending_user_name = username
    tm.temperature = temperature
    tm.pub_date = datetime.datetime.now()
    tm.isactive = False
    b = tm.save()

    return HttpResponse("added")