Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
0ea0d777
Commit
0ea0d777
authored
5 years ago
by
Pierre-antoine Comby
Browse files
Options
Downloads
Patches
Plain Diff
fix
#27
parent
c372b658
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!30
fix #27
Pipeline
#7816
passed with warnings with stages
in 3 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/member/views.py
+4
-6
4 additions, 6 deletions
apps/member/views.py
templates/member/profile_detail.html
+1
-1
1 addition, 1 deletion
templates/member/profile_detail.html
with
5 additions
and
7 deletions
apps/member/views.py
+
4
−
6
View file @
0ea0d777
...
...
@@ -51,15 +51,13 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
model
=
User
fields
=
[
'
first_name
'
,
'
last_name
'
,
'
username
'
,
'
email
'
]
template_name
=
'
member/profile_update.html
'
context_object_name
=
'
user_object
'
second_form
=
ProfileForm
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
context
[
'
user_modified
'
]
=
context
[
'
user
'
]
context
[
'
user
'
]
=
self
.
request
.
user
context
[
"
profile_form
"
]
=
self
.
second_form
(
instance
=
context
[
'
user_
modified
'
].
profile
)
instance
=
context
[
'
user_
object
'
].
profile
)
context
[
'
title
'
]
=
_
(
"
Update Profile
"
)
return
context
...
...
@@ -74,7 +72,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
# Si l'utilisateur cherche à modifier son pseudo, le nouveau pseudo ne doit pas être proche d'un alias existant
note
=
NoteUser
.
objects
.
filter
(
alias__normalized_name
=
Alias
.
normalize
(
new_username
))
if
note
.
exists
()
and
note
.
get
().
user
!=
self
.
request
.
user
:
if
note
.
exists
()
and
note
.
get
().
user
!=
self
.
object
:
form
.
add_error
(
'
username
'
,
_
(
"
An alias with a similar name already exists.
"
))
...
...
@@ -83,7 +81,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
def
form_valid
(
self
,
form
):
profile_form
=
ProfileForm
(
data
=
self
.
request
.
POST
,
instance
=
self
.
request
.
user
.
profile
,
instance
=
self
.
object
.
profile
,
)
if
form
.
is_valid
()
and
profile_form
.
is_valid
():
new_username
=
form
.
data
[
'
username
'
]
...
...
This diff is collapsed.
Click to expand it.
templates/member/profile_detail.html
+
1
−
1
View file @
0ea0d777
...
...
@@ -12,7 +12,7 @@
<dd
class=
"col-xl-6"
>
{{ object.last_name }} {{ object.first_name }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'username'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
{{
user
.username }}
</dd>
<dd
class=
"col-xl-6"
>
{{
object
.username }}
</dd>
<dt
class=
"col-xl-6"
>
{% trans 'password'|capfirst %}
</dt>
<dd
class=
"col-xl-6"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment