Esempio n. 1
0
 def setUp(self):
     data = self.create_user_admin()
     self.resp = self.client.post(r('core:login'), data)
     self.resp = self.client.post(r(view_in_test))
     register_new_teacher('*****@*****.**', '123mudar')
     User = get_user_model()
     self.id = User.objects.get(email='*****@*****.**').pk
     update_user(self.id, '1234mudar', 'José', 'Silva')
     data = {}
     data['user_id'] = self.id
     data['password'] = '******'
     data['first_name'] = 'John'
     data['last_name'] = 'Doe'
     self.resp = self.client.post(r(view_in_test), data, follow=True)
 def setUp(self):
     self.username = '******'
     self.old_password = '******'
     User = get_user_model()
     register_new_student(self.username, self.old_password)
     id = User.objects.get(email='*****@*****.**').pk
     self.returned = update_user(id)
     self.user = authenticate(self.username, self.old_password)
Esempio n. 3
0
def editar_usuarios(request):
    if request.method == 'GET':
        context = {'form': UserEditForm()}
        return render(request, 'editar_usuarios.html', context)
    else:
        form = UserEditForm(request.POST)
        if form.is_valid():
            user_id = form.cleaned_data.get('user_id', '')
            password = form.cleaned_data.get('password', '')
            first_name = form.cleaned_data.get('first_name', '')
            last_name = form.cleaned_data.get('last_name', '')
            update_user(id=user_id.pk,
                        password=password,
                        first_name=first_name,
                        last_name=last_name)

        else:
            context = {'form': form}
            return render(request, 'editar_usuarios.html', context)
        context = {
            'title': 'Editar usuário na plataforma FATEC',
            'msg': 'Edição do usuário realizada com sucesso !',
        }
        return render(request, 'cadastro_edicao_concluido.html', context)