Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #153. Possibilita o usuário editar seus dados #163

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Resolve #153. Possibilita o usuário editar seus dados #163

wants to merge 3 commits into from

Conversation

itepifanio
Copy link

No description provided.

Copy link
Owner

@turicas turicas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obrigado pelas contribuições, Ítalo! Adicionei alguns comentários sobre mudanças.

@@ -36,4 +36,5 @@
path('troca-senha/atualizada/', views_config['password_reset_complete'], name='password_reset_complete'),
path('logout/', views_config['logout'], name='logout'),
path('entrar/', CreateUserView.as_view(), name='sign_up'),
path('editar-perfil/<int:user_id>', ProfileUpdate.as_view(), name='profile_update_form')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como o usuário estará logado, não necessitamos passar seu id pela URL pois podemos pegá-lo diretamente por request.user.id (exemplo, para atualizar seu perfil no GitHub, a URL é a mesma para todos usuários: https://github.com/settings/profile).

@@ -24,3 +27,12 @@ def form_valid(self, *args, **kwargs):
login(self.request, self.object)
url = self.request.POST.get('next', None) or self.success_url
return redirect(url)


class ProfileUpdate(UpdateView):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como para acessar essa página o usuário precisa estar logado, precisamos adicionar aqui o decorator login_required - veja exemplo na documentação do Django.

@itepifanio
Copy link
Author

Removi a pk da url, adicionei o login_required pra editar o perfil do usuário e resolvi o conflito com a branch develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants