-
Notifications
You must be signed in to change notification settings - Fork 0
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
Ss 643 make an option to edit account details #235
Draft
anondo1969
wants to merge
13
commits into
develop
Choose a base branch
from
SS-643-Make-an-option-to-edit-account-details
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d321a3f
Updated info about using Serve for teaching (#194)
akochari 2b5cadc
Revert "Updated info about using Serve for teaching (#194)"
akochari 2d769be
Merge branch 'staging' into main
sandstromviktor ab7d54f
Merge branch 'staging'
churnikov 46f589c
Merge branch 'staging'
churnikov c958069
SS-643-Make-an-option-to-edit-account-details
anondo1969 7c8099b
SS-643-Make-an-option-to-edit-account-details
anondo1969 4e3de76
SS-643 extending ProfileForm
anondo1969 d38f4ce
SS-643 Updated edit HTML form
anondo1969 d86a443
SS-643 Updated edit HTML form
anondo1969 32b49eb
SS-643 pre-commit check fixed
anondo1969 bba6f8b
SS-643 pre-commit with black check
anondo1969 0048d66
SS-643 pre-commit with black check 2
anondo1969 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
from common.models import EmailVerificationTable, UserProfile | ||
from studio.utils import get_logger | ||
|
||
from django.utils.translation import gettext_lazy as _ | ||
|
||
logger = get_logger(__name__) | ||
|
||
|
||
|
@@ -370,7 +372,7 @@ class Meta: | |
def __repr__(self) -> str: | ||
return f"{self.__class__.__name__}({self.data})" | ||
|
||
''' | ||
class ProfileEditForm(BootstrapErrorFormMixin, forms.ModelForm): | ||
affiliation = forms.ChoiceField( | ||
widget=forms.Select(attrs={"class": "form-control"}), | ||
|
@@ -403,4 +405,44 @@ class Meta: | |
|
||
def __repr__(self): | ||
return f"{self.__class__.__name__}({self.data})" | ||
''' | ||
|
||
class ProfileEditForm(ProfileForm): | ||
|
||
|
||
class Meta(ProfileForm.Meta): | ||
|
||
exclude = ["note", | ||
"why_account_needed",] | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(ProfileEditForm, self).__init__(*args, **kwargs) | ||
self.fields["affiliation"].disabled=True | ||
#self.fields["affiliation"].required = False | ||
self.fields["affiliation"].help_text="Affiliation can not be changed. Please email [email protected] with any questions." | ||
|
||
''' | ||
class UserEditForm(UserForm): | ||
|
||
|
||
class Meta(UserForm.Meta): | ||
|
||
exclude = [ | ||
"username", | ||
"password1", | ||
"password2", | ||
] | ||
def __init__(self, *args, **kwargs): | ||
super(UserEditForm, self).__init__(*args, **kwargs) | ||
self.fields["email"].disabled=True | ||
self.fields["email"].help_text="Email address can not be changed. Please email [email protected] with any questions." | ||
del self.fields["password1"] | ||
del self.fields["password2"] | ||
self.fields["email"].required = False | ||
''' | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -167,7 +167,9 @@ def get(self, request, *args, **kwargs): | |||||
profile_edit_form = self.profile_edit_form_class(initial={ | ||||||
"affiliation" : user_profile_data.affiliation, | ||||||
"department" : user_profile_data.department | ||||||
}) | ||||||
}) | ||||||
|
||||||
|
||||||
user_edit_form = self.user_edit_form_class(initial={ | ||||||
"email" : user_profile_data.user.email, | ||||||
"first_name" : user_profile_data.user.first_name, | ||||||
|
@@ -206,7 +208,9 @@ def post(self, request, *args, **kwargs): | |||||
# was invalid | ||||||
|
||||||
#print (form.errors) | ||||||
logger.error("Edit user error: " + str(user_form_details.errors), exc_info=True) | ||||||
logger.error("Edit profile error: " + str(profile_form_details.errors), exc_info=True) | ||||||
if user_form_details.is_valid()==False: | ||||||
logger.error("Edit user error: " + str(user_form_details.errors), exc_info=True) | ||||||
if profile_form_details.is_valid()==False: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rewrote it. |
||||||
logger.error("Edit profile error: " + str(profile_form_details.errors), exc_info=True) | ||||||
|
||||||
return render(request, self.template_name, {"form": user_form_details, "profile_form": profile_form_details}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
rewrote it.