-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
brasilio_auth/urls.py
Outdated
@@ -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') |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
Removi a pk da url, adicionei o login_required pra editar o perfil do usuário e resolvi o conflito com a branch develop |
No description provided.