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

#P03. As Participant, I would like to update my profile. #98

Merged

Conversation

natalijabujevic0708
Copy link
Contributor

Description

The users can edit their profile details:

  • First Name
  • Last Name
  • Email Address
  • Slack Display Name
  • User type
  • Current Module on LMS

Pull request type

Testing

All testing was done manually and the profile was successfully edited and updated.

Screenshots

  1. Original profile page.
    hackathon-app_profile_page

2.Edit Profile
hackathon-app_edit_profile

  1. Updated Profile
    hackathon-app_edited_profile

Additional Information

There is one field missing on the edit profile page:

Shipping Address

  • hidden by default
  • is enabled only if part of a winning team

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

  • Yes
  • No

Add EditProfileForm in forms.py.
Create edit_profile view and urls.
Create edit_profile.html.
Add an Edit Profile button on profile.htm.
Copy link
Member

@stefdworschak stefdworschak left a 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.

  1. Adding user_type and current_lms_module to the profile view
  2. Applying some better styling to the edit profile form

<div class="container">
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
<table>
Copy link
Member

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">
Copy link
Member

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():
Copy link
Member

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.

return redirect('profile')
else:
form = EditProfileForm(instance=request.user)
contex = {
Copy link
Member

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.

'first_name',
'last_name',
'slack_display_name',
'user_type',
Copy link
Member

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.

@natalijabujevic0708
Copy link
Contributor Author

@stefdworschak I made the changes, let me know if everything is ok or I should change something :)

Copy link
Member

@stefdworschak stefdworschak left a 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 stefdworschak added the hacktoberfest-accepted Accepted PR during Hacktoberfest label Oct 24, 2020
@stefdworschak stefdworschak linked an issue Oct 24, 2020 that may be closed by this pull request
@natalijabujevic0708
Copy link
Contributor Author

@stefdworschak done :)

@stefdworschak stefdworschak merged commit c9a20cf into Code-Institute-Community:master Oct 25, 2020
@stefdworschak stefdworschak linked an issue Oct 31, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Accepted PR during Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#S03. As Staff, I would like to update my profile. #P03. As Participant, I would like to update my profile.
2 participants