Commit 1f37d1cf authored by Enrico Zini's avatar Enrico Zini
Browse files

Added new view for editing email, and all missing templates

parent 014e3620
{% 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 %}
{% 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 %}
{% 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 %}
{% 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 %}
......@@ -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 %}
......
......@@ -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"),
]
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment