[extensions-web] Remove profile_edit.html template
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Remove profile_edit.html template
- Date: Mon, 14 Nov 2011 14:39:27 +0000 (UTC)
commit b3fc0f7f544df38f8318c4f65b4e4a41aed33249
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Nov 13 22:51:18 2011 -0500
Remove profile_edit.html template
.../auth/templates/registration/profile.html | 8 +++++++-
.../auth/templates/registration/profile_edit.html | 5 -----
sweettooth/auth/views.py | 15 ++++++++-------
3 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/sweettooth/auth/templates/registration/profile.html b/sweettooth/auth/templates/registration/profile.html
index dcb263e..beb9ad0 100644
--- a/sweettooth/auth/templates/registration/profile.html
+++ b/sweettooth/auth/templates/registration/profile.html
@@ -5,7 +5,13 @@
{% load thumbnail %}
{% load gravatar %}
<div class="profile">
- <h2 id="new_display_name">{{ display_name }}</h2>
+ {% if is_editable %}
+ <h2 class="editable"
+ id="new_display_name"
+ editurl="{% url auth-ajax-edit-display-name %}">{{ display_name }}</h2>
+ {% else %}
+ <h2>{{ display_name }}</h2>
+ {% endif %}
<img class="gravatar" src="{% gravatar_url user.email 128 %}">
<h3> {{ display_name }} has authored </h3>
diff --git a/sweettooth/auth/views.py b/sweettooth/auth/views.py
index 2191b1c..fb1dcd5 100644
--- a/sweettooth/auth/views.py
+++ b/sweettooth/auth/views.py
@@ -13,18 +13,19 @@ from utils import render
def profile(request, user):
userobj = get_object_or_404(models.User, username=user)
- template = 'registration/profile.html'
- if request.user == userobj:
- template = 'registration/profile_edit.html'
+ is_editable = request.user == userobj
display_name = userobj.get_full_name() or userobj.username
extensions = Extension.objects.filter(creator=userobj)
reviews = CodeReview.objects.filter(reviewer=userobj)
- return render(request, template, dict(user=userobj,
- display_name=display_name,
- extensions=extensions,
- reviews=reviews,))
+ return render(request,
+ 'registration/profile.html',
+ dict(user=userobj,
+ display_name=display_name,
+ extensions=extensions,
+ reviews=reviews,
+ is_editable=is_editable))
@ajax_view
@post_only_view
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]