def detail(request): offsite = Offsite.get_instance() uploads = list(LocalUploadRequest.objects.all()) + list( RemoteUploadRequest.objects.all()) content = [] for upload in uploads: content.append({ 'type': 'ok', 'date': upload.last_attempt or upload.created_at, 'label': upload.volume.filename, 'message': "%.2f MB" % utils.bytes_to_mb(upload.volume.size) }) transferencias_em_execucao = [{ 'title': u'Transferências em execução', 'content': content }] if offsite.active: graphic = Graphics() graph_block = graphic.data_to_template()[0] else: ocupacao_offsite = 0.0 messages.error(request, "Offsite desativado") return render_to_response(request, "detail.html", locals())
def csv_data(request): g = Graphics() d = g.last_days(days=90) r = ["Date,Utilizado"] for i in d: r.append("%s,%s" % (i.timestamp.strftime("%Y/%m/%d %H:%M:%S"), float(i.used)/1073741824.0)) return HttpResponse("\n".join(r))
def csv_data(request): g = Graphics() d = g.last_days(days=90) r = ["Date,Utilizado"] for i in d: r.append("%s,%s" % (i.timestamp.strftime("%Y/%m/%d %H:%M:%S"), float(i.used) / 1073741824.0)) return HttpResponse("\n".join(r))
def detail(request): offsite = Offsite.get_instance() uploads = list(LocalUploadRequest.objects.all()) + list(RemoteUploadRequest.objects.all()) content = [] for upload in uploads: content.append({'type' : 'ok', 'date' : upload.last_attempt or upload.created_at, 'label' : upload.volume.filename, 'message' : "%.2f MB" % utils.bytes_to_mb(upload.volume.size) }) transferencias_em_execucao = [{'title': u'Transferências em execução', 'content': content}] if offsite.active: graphic = Graphics() graph_block = graphic.data_to_template()[0] else: ocupacao_offsite = 0.0 messages.error(request, "Offsite desativado") return render_to_response(request, "detail.html", locals())