Revision 616132316534 () - Diff

Link to this snippet: https://friendpaste.com/6IlE6zb1h3B8TYCdaoUtAO
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def liberar_lab(request):
lab = Laboratorio()
arquivo = open('/home/aluno/liberar.txt')
resultado_linha = ''
resultado = ''
linha = []
if request.method=='POST':
for a in range(0,23):
try:
liberar = request.POST['id_lab_%s'%a]
if liberar:
linha[a] = '1\n'
else:
linha[a] = '0\n'
except:
None
resultado = resultado_linha.join(linha)
arquivo.write(resultado)
arquivo.close()

return render_to_response ('laboratorios.html', {'lab': lab},
context_instance = RequestContext(request))