Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
1f37d1cf
Commit
1f37d1cf
authored
Jul 04, 2016
by
Enrico Zini
Browse files
Added new view for editing email, and all missing templates
parent
014e3620
Changes
7
Hide whitespace changes
Inline
Side-by-side
person/templates/person/base.html
0 → 100644
View file @
1f37d1cf
{% extends "nm-base.html" %}
{% comment %}
{% block head_resources %}
{{block.super}}
<link
type=
"text/css"
rel=
"stylesheet"
media=
"all"
href=
"{{ STATIC_URL }}css/person.css"
>
{% endblock %}
{% endcomment %}
person/templates/person/edit_bio.html
0 → 100644
View file @
1f37d1cf
{% extends "person/base.html" %}
{% load nm %}
{% block content %}
<h1>
Edit short bio for {{person.fullname}}
</h1>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<table
class=
"personinfo"
>
{% for field in form %}
<tr>
<th>
{{field.label_tag}}
</th>
<td>
{{field}} {{field.errors}}
</td>
</tr>
{% endfor %}
</table>
<button
type=
"submit"
>
Submit
</button>
</form>
{% endblock %}
person/templates/person/edit_email.html
0 → 100644
View file @
1f37d1cf
{% extends "person/base.html" %}
{% load nm %}
{% block content %}
<h1>
Edit email for {{person.fullname}}
</h1>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<table
class=
"personinfo"
>
{% for field in form %}
<tr>
<th>
{{field.label_tag}}
</th>
<td>
{{field}} {{field.errors}}
</td>
</tr>
{% endfor %}
</table>
<button
type=
"submit"
>
Submit
</button>
</form>
{% endblock %}
person/templates/person/edit_ldap.html
0 → 100644
View file @
1f37d1cf
{% extends "person/base.html" %}
{% load nm %}
{% block content %}
<h1>
Edit LDAP information for {{person.fullname}}
</h1>
<form
action=
""
method=
"POST"
>
{% csrf_token %}
<table
class=
"personinfo"
>
{% for field in form %}
<tr>
<th>
{{field.label_tag}}
</th>
<td>
{{field}} {{field.errors}}
</td>
</tr>
{% endfor %}
</table>
<button
type=
"submit"
>
Submit
</button>
</form>
{% endblock %}
person/templates/person/person.html
View file @
1f37d1cf
...
...
@@ -31,6 +31,9 @@ $(function() {
<table
class=
"personinfo"
>
<tr><th>
Account name
</th><td>
{{person.uid|default:"None chosen yet"}}
</td></tr>
<tr><th>
OpenPGP fingerprint
</th><td>
{{person.fpr|fingerprint}}{% if "edit_ldap" in visit_perms %} (
<a
href=
"{% url 'fprs_person_list' key=person.lookup_key %}"
>
manage
</a>
){% endif %}
</td></tr>
{% if "edit_email" in visit_perms %}
<tr><th>
Contact email
</th><td>
{{person.email}}
<a
href=
"{% url 'person_edit_email' key=person.lookup_key %}"
>
[edit]
</a></td></tr>
{% endif %}
<tr><th>
Status
</th><td>
{{person.status|desc_status}} {% if person.status == STATUS_DC %}on nm.debian.org since{% else %}since{% endif %} {{person.status_changed|date:"Y-m-d"}}
{% if person.changed_before_data_import %}
(changed before data import)
...
...
@@ -66,10 +69,6 @@ $(function() {
<a
href=
"{% url 'person_edit_ldap' key=person.lookup_key %}"
>
edit LDAP information
</a>
{% endif %}
{% if "edit_bio" in visit_perms %}
<a
href=
"{% url 'person_edit_bio' key=person.lookup_key %}"
>
edit bio
</a>
{% endif %}
{% if person.is_am %}
{% if visitor.is_am or visitor.is_admin %}
<a
href=
"{% url 'restricted_amprofile' key=person.lookup_key %}"
>
edit AM
</a>
...
...
@@ -91,6 +90,10 @@ $(function() {
{% endif %}
</div>
{% if "edit_bio" in visit_perms %}
<a
href=
"{% url 'person_edit_bio' key=person.lookup_key %}"
>
[edit]
</a>
{% endif %}
<h2>
Personal history
</h2>
{% include "process/process_list.html" with procs=processes2 proctable_archive=True %}
...
...
person/urls.py
View file @
1f37d1cf
...
...
@@ -12,5 +12,6 @@ urlpatterns = [
url
(
r
'^(?P<key>[^/]+)$'
,
views
.
Person
.
as_view
(),
name
=
"person"
),
url
(
r
'^(?P<key>[^/]+)/edit_ldap$'
,
views
.
EditLDAP
.
as_view
(),
name
=
"person_edit_ldap"
),
url
(
r
'^(?P<key>[^/]+)/edit_bio$'
,
views
.
EditBio
.
as_view
(),
name
=
"person_edit_bio"
),
url
(
r
'^(?P<key>[^/]+)/edit_email$'
,
views
.
EditEmail
.
as_view
(),
name
=
"person_edit_email"
),
]
person/views.py
View file @
1f37d1cf
...
...
@@ -117,3 +117,24 @@ class EditBio(VisitPersonMixin, UpdateView):
self
.
object
=
form
.
save
(
commit
=
False
)
self
.
object
.
save
(
audit_author
=
self
.
visitor
,
audit_notes
=
"edited bio information"
)
return
super
(
EditBio
,
self
).
form_valid
(
form
)
class
EditEmail
(
VisitPersonMixin
,
UpdateView
):
"""
Edit a person's information
"""
require_visit_perms
=
"edit_email"
model
=
bmodels
.
Person
fields
=
(
"email"
,)
template_name
=
"person/edit_email.html"
def
get_object
(
self
):
return
self
.
person
def
form_valid
(
self
,
form
):
"""
If the form is valid, save the associated model.
"""
self
.
object
=
form
.
save
(
commit
=
False
)
self
.
object
.
save
(
audit_author
=
self
.
visitor
,
audit_notes
=
"edited email"
)
return
super
(
EditEmail
,
self
).
form_valid
(
form
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment