def post(request): turno = Turno( cajero = request.POST["nombre"], fecha_inicio = datetime.now(), fecha_fin = datetime.now(), ajuste = None ) turno.save() return HttpResponse(simplejson.dumps( turno.resumen()), content_type = 'application/javascript; charset=utf8')
def loguear(request): username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) turno = Turno(cajero=username, fecha_inicio=datetime.now(), fecha_fin=None, ajuste=None) turno.save() return redirect(reverse('index'))