-
Notifications
You must be signed in to change notification settings - Fork 41
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
#P03. As Participant, I would like to update my profile. #98
#P03. As Participant, I would like to update my profile. #98
Conversation
Add EditProfileForm in forms.py. Create edit_profile view and urls. Create edit_profile.html. Add an Edit Profile button on profile.htm.
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.
@natalijabujevic0708 looking very good, there are just a few minor comments from me. Overall there are also two extra things that I would like you to look at as part of this PR.
- Adding user_type and current_lms_module to the profile view
- Applying some better styling to the edit profile form
<div class="container"> | ||
<form method="post" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
<table> |
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.
Why did you add a table here? I don't think that's needed.
|
||
{% block content %} | ||
<h1>Edit Profile</h1> | ||
<div class="container"> |
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.
The base template already has an element with a container
class, so I would remove this div.
if request.method == 'POST': | ||
form = EditProfileForm(request.POST, instance=request.user) | ||
|
||
if form.is_valid(): |
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.
I think you need to add another else
here for when form.is_valid()
is not True
.
accounts/views.py
Outdated
return redirect('profile') | ||
else: | ||
form = EditProfileForm(instance=request.user) | ||
contex = { |
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.
I think you mispelt context here, but I would just pass the dict directly into render
.
accounts/forms.py
Outdated
'first_name', | ||
'last_name', | ||
'slack_display_name', | ||
'user_type', |
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.
Could you please remove this field? I don't think the user should be able to change this. Instead a change in user_type
should come from an admin.
@stefdworschak I made the changes, let me know if everything is ok or I should change something :) |
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.
LGTM
@natalijabujevic0708 we merged some more changes and it seems there is a merge conflict now, could you just resolve that and let me know once it's done so I can merge the PR?
@stefdworschak done :) |
Description
The users can edit their profile details:
Pull request type
Testing
All testing was done manually and the profile was successfully edited and updated.
Screenshots
2.Edit Profile
![hackathon-app_edit_profile](https://user-images.githubusercontent.com/67863074/97017385-be9fc300-1545-11eb-93c2-36e38d7baad4.png)
Additional Information
There is one field missing on the edit profile page:
Shipping Address
I am planning to add it in the future as currently I don't know how to implement the condition enabled only if part of a winning team
Does this introduce a breaking change