def update(self, request, matricula): aluno = buscar_aluno(matricula) impressao_digital = request.data.get('digital', None) if aluno is not None and impressao_digital is not None: basic_authentication = HttpBasicAuthentication() if not basic_authentication.is_authenticated(request): return basic_authentication.challenge() aluno.set_impressao_digital(psycopg2.Binary(str(impressao_digital)))
def update(self, request, matricula): aluno = buscar_aluno(matricula) basic_authentication = HttpBasicAuthentication() if not basic_authentication.is_authenticated(request): return basic_authentication.challenge() if aluno != None: if aluno_nao_comeu(aluno): try: RefeicaoMensalDoAluno.deduzir_refeicao_do_aluno(aluno, mes_corrente(), ANO_LETIVO) aluno.consumir_refeicao() except RefeicaoEsgotada: return HttpResponseForbidden() else: return HttpResponseForbidden() else: return HttpResponseForbidden()
def read(self, request): basic_authentication = HttpBasicAuthentication() if not basic_authentication.is_authenticated(request): return basic_authentication.challenge()