Exemple #1
0
 def form_valid(self, form):
     name = form.cleaned_data['name']
     username = form.cleaned_data['username']
     email = form.cleaned_data['email']
     
     chat = ChatApi()
     chat.login(name, username, email)
     
     self.request.session['token'] = chat.token
     
     data = {'token': chat.token}
     return HttpResponse(json.dumps(data), mimetype="application/json")
Exemple #2
0
 def update(self, token, **kwargs):
     chat = ChatApi(token=token)
     chat.update()        
     return HttpResponse(json.dumps([message.json() for message in chat.messages]), mimetype="application/json")
Exemple #3
0
 def send(self, token, **kwargs):
     chat = ChatApi(token=token)
     chat.send(kwargs["message"])
     return HttpResponse(json.dumps({'ok': 'ok'}), mimetype="application/json")