本文整理汇总了Python中nimbus.shared.views.render_to_response函数的典型用法代码示例。如果您正苦于以下问题:Python render_to_response函数的具体用法?Python render_to_response怎么用?Python render_to_response使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render_to_response函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: network
def network(request):
logger = logging.getLogger(__name__)
extra_context = {'wizard_title': u'2 de 4 - Configuração de Rede',
'page_name': u'network'}
if request.method == "GET":
interface = NetworkInterface.get_instance()
Form = form(NetworkInterface)
extra_context['form'] = Form(instance=interface)
return render_to_response( request, "generic.html", extra_context)
else:
edit_singleton_model(request, "generic.html",
"nimbus.wizard.views.timezone",
model = NetworkInterface,
extra_context = extra_context)
interface = NetworkInterface.get_instance()
if interface.address == get_raw_network_interface_address():
return redirect( "nimbus.wizard.views.timezone" )
else:
logger.info('redirecting user to redirect page')
return render_to_response(request, "redirect.html",
dict(ip_address=interface.address,
url=reverse('nimbus.wizard.views.timezone')))
开发者ID:DangerTweaker,项目名称:nimbus-opensource,代码行数:25,代码来源:views.py
示例2: add
def add(request, teste=None):
comp_id = 0
if request.GET:
comp_id = request.GET["comp_id"]
title = u"Adicionar backup"
form = ProcedureForm(prefix="procedure")
content = {'title': title,
'form':form,
'comp_id': comp_id}
if request.method == "POST":
data = copy(request.POST)
if data["procedure-fileset"]:
fileset = FileSet.objects.get(id=data['procedure-fileset'])
content['fileset'] = fileset
if data["procedure-schedule"]:
schedule = Schedule.objects.get(id=data['procedure-schedule'])
content['schedule'] = schedule
procedure_form = ProcedureForm(data, prefix="procedure")
if procedure_form.is_valid():
procedure = procedure_form.save()
messages.success(request, "Procedimento de backup '%s' criado com sucesso" % procedure.name)
return redirect('/procedures/list')
else:
messages.error(request, "O procedimento de backup não foi criado devido aos seguintes erros")
content['form'] = procedure_form
return render_to_response(request, "add_procedure.html", content)
return render_to_response(request, "add_procedure.html", content)
开发者ID:fenrrir,项目名称:nimbus-opensource,代码行数:27,代码来源:views.py
示例3: edit
def edit(request, procedure_id):
p = get_object_or_404(Procedure, pk=procedure_id)
title = u"Editando '%s'" % p.name
partial_form = ProcedureForm(prefix="procedure", instance=p)
content = {'title': title,
'form': partial_form,
'id': procedure_id,
'procedure': p,
'schedule': p.schedule,
'fileset': p.fileset,
'retention_time': p.pool_retention_time}
print content
print content['schedule'].id
if request.method == "POST":
data = copy(request.POST)
if data['procedure-schedule'] == u"":
data['procedure-schedule'] = u"%d" % p.schedule.id
if data['procedure-fileset'] == u"":
data['procedure-fileset'] = u"%d" % p.fileset.id
procedure_form = ProcedureForm(data, instance=p, prefix="procedure")
if procedure_form.is_valid():
procedure_form.save()
messages.success(request, "Procedimento '%s' alterado com sucesso" % p.name)
return redirect('/procedures/list')
else:
messages.error(request, "O procedimento de backup não foi criado devido aos seguintes erros")
content['forms'] = [procedure_form]
return render_to_response(request, "edit_procedure.html", content)
return render_to_response(request, 'edit_procedure.html', content)
开发者ID:fenrrir,项目名称:nimbus-opensource,代码行数:29,代码来源:views.py
示例4: about
def about(request):
version_file = settings.VERSION_FILE
with file(version_file) as f:
version_content = f.read().strip()
version, githash = version_content.split('-')
computers = len(Computer.objects.exclude(id=1))
all_procedures = Procedure.objects.exclude(id=1)
jobs = 0
for procedure in all_procedures:
jobs += len(procedure.all_my_good_jobs)
procedures = len(all_procedures)
try:
last_backup = Procedure.objects.get(id=1).last_success_date().endtime.strftime("%d/%m/%Y - %H:%M:%S")
except IndexError:
last_backup = "Não realizado"
data = {'computers': computers,
'procedures': procedures,
'jobs': jobs,
'last_backup': last_backup,
'version': version,
'release': githash
}
return render_to_response(request, "about.html", data)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:29,代码来源:views.py
示例5: delete
def delete(request, object_id):
c = get_object_or_404(Computer, pk=object_id)
jobs = c.all_my_jobs
content = {'computer': c,
'last_jobs': jobs,
'procedures': c.procedure_set.all()}
return render_to_response(request, "remove_computer.html", content)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:7,代码来源:views.py
示例6: add
def add(request):
lforms = [ forms.ComputerForm ]
content = {'title':u'Ativar novo Computador',
'forms':lforms,
'computers':Computer.objects.filter(active=False,id__gt=1)
}
return render_to_response(request, "computers_add.html", content)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:7,代码来源:views.py
示例7: list_uploadrequest
def list_uploadrequest(request):
uploads_requests = list(LocalUploadRequest.objects.all()) + list(RemoteUploadRequest.objects.all())
if 'ajax' in request.POST:
l = []
for up in uploads_requests:
d = {}
d['pk'] = up.id
# d['model'] = up.model
d['fields'] = {}
d['fields']['filename'] = up.volume.filename
d['fields']['created_at'] = up.created_at.strftime("%d/%m/%Y %H:%M")
d['fields']['attempts'] = up.attempts
if up.last_attempt:
d['fields']['last_attempt'] = up.last_attempt.strftime("%d/%m/%Y %H:%M")
else:
d['fields']['last_attempt'] = None
d['fields']['friendly_rate'] = up.friendly_rate
d['fields']['estimated_transfer_time'] = up.estimated_transfer_time
d['fields']['finished_percent'] = up.finished_percent
l.append(d)
# response = serializers.serialize("json", uploads_requests)
response = simplejson.dumps(l)
return HttpResponse(response, mimetype="text/plain")
return render_to_response(request,
"list_downuploadrequest.html",
{"object_list": uploads_requests,
"list_type": "Uploads",
"title": u"Uploads ativos"})
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:28,代码来源:views.py
示例8: step3
def step3(request):
"""Selecionar o JOB"""
if request.method == "POST":
data = request.POST
computer = Computer.objects.get(id=data["computer_id"])
procedure = Procedure.objects.get(id=data["procedure_id"])
if data.has_key("start_date") and data.has_key("end_date"):
start_date = datetime.strptime(data["start_date"], "%d/%m/%Y")
end_date = datetime.strptime(data["end_date"] + " 23:59:59", "%d/%m/%Y %H:%M:%S")
jobs = procedure.get_backup_jobs_between(start_date, end_date)
else:
end_date = datetime.now()
start_date = datetime.today() - timedelta(30)
jobs = procedure.get_backup_jobs_between(start_date, end_date)
# jobs = procedure.all_my_good_jobs
extra_content = {
'computer': computer,
'procedure': procedure,
'jobs': jobs,
'start_date': start_date.strftime("%d/%m/%Y"),
'end_date': end_date.strftime("%d/%m/%Y"),
'title': u"Restauração de arquivos"
}
return render_to_response(request, "step3.html", extra_content)
else:
return redirect('nimbus.restore.views.step1')
开发者ID:DangerTweaker,项目名称:nimbus-opensource,代码行数:26,代码来源:views.py
示例9: list
def list(request):
d = {
"storages" : Storage.objects.filter(active=True),
"title": u"Armazenamento"
}
return render_to_response(request, "storages_list.html", d)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:7,代码来源:views.py
示例10: list_offsite
def list_offsite(request):
procedures = Procedure.with_job_tasks('Offsite')
last_jobs = Procedure.jobs_with_job_tasks('Offsite')
extra_content = {'procedures': procedures,
'last_jobs' : last_jobs,
'title': u"Procedimentos com offsite ativo"}
return render_to_response(request, "procedures_list.html", extra_content)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:8,代码来源:views.py
示例11: step1
def step1(request):
"""Selecionar o computador"""
computers = Computer.objects.filter(active=True,id__gt=1)
extra_content = {
'computers': computers,
'title': u"Restauração de arquivos"
}
return render_to_response(request, "step1.html", extra_content)
开发者ID:DangerTweaker,项目名称:nimbus-opensource,代码行数:8,代码来源:views.py
示例12: finish
def finish(request):
extra_content = {'title': u"Recuperação do sistema"}
if request.method == "GET":
return render_to_response(request, "recovery_finish.html", extra_content)
elif request.method == "POST":
wizard = Wizard.get_instance()
wizard.finish()
return redirect( "nimbus.base.views.home" )
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:8,代码来源:views.py
示例13: select_storage
def select_storage(request):
if request.method == "GET":
extra_content = {'wizard_title': u'Selecione o armazenamento',
'title': u"Recuperação do sistema",
'devices' : offsite.list_disk_labels()}
return render_to_response(request, "recovery_select_storage.html",
extra_content)
else:
raise Http404()
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:9,代码来源:views.py
示例14: view_computer
def view_computer(request, object_id):
storage = Storage.objects.get(id=object_id)
computers = Computer.objects.filter(procedure__profile__storage=storage)
d = {
"storage" : storage,
"computers" : computers,
"title": u'Computadores do armazenamento "%s"' % storage.name
}
return render_to_response(request, "computers_list.html", d)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:9,代码来源:views.py
示例15: profile_list
def profile_list(request):
title = u"Perfis de configuração"
filesets = FileSet.objects.filter(is_model=True)
schedules = Schedule.objects.filter(is_model=True)
computers = Computer.objects.filter(active=True,id__gt=1)
content = {'title': u"Perfis de configuração",
'filesets': filesets,
'schedules': schedules,
'computers': computers}
return render_to_response(request, "profile_list.html", content)
开发者ID:fenrrir,项目名称:nimbus-opensource,代码行数:10,代码来源:views.py
示例16: network_tool
def network_tool(request, type="ping"):
if type == "ping":
title = u"Teste de ping"
elif type == "traceroute":
title = u"Teste de traceroute"
elif type == "nslookup":
title = u"Teste de ns lookup"
extra_content = {'title': title, 'type': type}
return render_to_response(request, "system_network_tool.html", extra_content)
开发者ID:DangerTweaker,项目名称:nimbus-opensource,代码行数:11,代码来源:views.py
示例17: recover_volumes
def recover_volumes(request):
extra_content = {'wizard_title': u'Recuperando arquivos',
'title': u"Recuperação do sistema"}
if request.method == "GET":
return render_to_response(request, "recovery_recover_volumes.html",
extra_content)
elif request.method == "POST":
localsource = request.POST.get("localsource", "offsite")
if localsource != "offsite":
device = request.POST.get("device")
storage = StorageDeviceManager(device)
manager = offsite.LocalManager(storage, "/bacula")
else:
manager = offsite.RemoteManager()
systemprocesses.min_priority_job("Recovery nimbus volumes",
recover_volumes_worker, manager)
extra_content.update({ "object_list" : DownloadRequest.objects.all()})
return render_to_response(request, "recovery_recover_volumes.html", extra_content)
else:
raise Http404()
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:20,代码来源:views.py
示例18: stat
def stat(request):
memory = systeminfo.get_memory_usage()
memory_free = 100 - memory
extra_content = {
'title': u"Estatística do sistema",
'cpu' : systeminfo.get_cpu_usage(),
'memory' : memory,
'memory_free' : memory_free
}
return render_to_response(request, "stat.html", extra_content)
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:11,代码来源:views.py
示例19: home
def home(request):
job_bytes = Job.get_bytes_from_last_jobs()
grafico_backup_dados = {
'title': u"Quantidade de dados realizados backup", 'width': "100%",
'type': "bar",
'cid': "chart1",
'header': [d.strftime("%d/%m/%y") for d in sorted(job_bytes)],
'labels': [utils.filesizeformat(v) for k, v in sorted(job_bytes.items())],
'lines': {
"Dados": utils.ordered_dict_value_to_formatted_float(job_bytes)
}
}
job_files = Job.get_files_from_last_jobs()
grafico_backup_arquivos = {
'title': u"Quantidade de arquivos realizados backup", 'width': "100%",
'type': "bar",
'cid': "chart2",
'header': [d.strftime("%d/%m/%y") for d in sorted(job_files)],
'labels': [int(v) for k, v in sorted(job_files.items())],
'lines': {
"Arquivos": [int(v) for k, v in sorted(job_files.items())]
}
}
graphics = Graphics()
blocks = graphics.render_blocks()
memory = systeminfo.get_memory_usage()
memory_free = 100 - memory
grafico_uso_memoria = {'title': u"Uso da memória", 'width': "90%", 'type': "pie", 'cid': "chart4", 'header': ["Gigabytes"],
'lines': {
"Disponível": [memory_free],
"Ocupado": [memory]}}
cpu = systeminfo.get_cpu_usage()
cpu_free = 100 - memory
grafico_uso_cpu = {'title': u"Uso da CPU", 'width': "", "type": "pie", 'cid': "chart5", 'header': ["Clocks"], 'lines': {
"Disponível": [cpu_free],
"Ocupado": [cpu]}}
# Dados de content:
# - type
# - label
# - date
# - message
last_jobs = Procedure.all_non_self_jobs()[:5]
return render_to_response(request, "home.html", locals())
开发者ID:DangerTweaker,项目名称:Nimbus,代码行数:53,代码来源:views.py
示例20: password
def password(request):
extra_context = {
'wizard_title': u'4 de 4 - Senha do usuário admin',
'page_name': u'password',
'previous': reverse('nimbus.wizard.views.timezone')
}
user = User.objects.get(id=1)
if request.method == "GET":
extra_context['form'] = SetPasswordForm(user)
return render_to_response( request, "generic.html", extra_context )
elif request.method == "POST":
form = SetPasswordForm(user, request.POST)
if form.is_valid():
form.save()
return redirect('nimbus.wizard.views.finish')
else:
extra_context['form'] = SetPasswordForm(user)
extra_context['messages'] = [u'Please fill all fields.']
return render_to_response( request, "generic.html", extra_context )
else:
raise Http404()
开发者ID:DangerTweaker,项目名称:nimbus-opensource,代码行数:21,代码来源:views.py
注:本文中的nimbus.shared.views.render_to_response函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论