diff options
-rwxr-xr-x | pytask/profile/views.py | 28 | ||||
-rw-r--r-- | pytask/templates/profile/view.html | 4 | ||||
-rw-r--r-- | pytask/templates/profile/view_user.html | 28 |
3 files changed, 34 insertions, 26 deletions
diff --git a/pytask/profile/views.py b/pytask/profile/views.py index b4fce21..d39ca1f 100755 --- a/pytask/profile/views.py +++ b/pytask/profile/views.py @@ -16,32 +16,36 @@ from pytask.profile.utils import get_user @login_required -def view_profile(request): +def view_profile(request, template_name='profile/view.html'): """ Display the profile information. """ user = request.user profile = user.get_profile() - context = {"user": user, - "profile": profile, - } - return shortcuts.render_to_response("profile/view.html", - RequestContext(request, context)) + context = { + 'user': user, + 'profile': profile, + } + + return shortcuts.render_to_response( + template_name, RequestContext(request, context)) @login_required -def view_user_profile(request, user_id): +def view_user_profile(request, user_id, template_name='profile/view_user.html'): """ Display the profile information of the user specified in the ID. """ user = shortcuts.get_object_or_404(User, pk=user_id) profile = user.get_profile() - context = {"user": user, - "profile": profile, - } - return shortcuts.render_to_response("profile/view.html", - RequestContext(request, context)) + context = { + 'user': user, + 'profile': profile, + } + + return shortcuts.render_to_response( + template_name, RequestContext(request, context)) @login_required def edit_profile(request): diff --git a/pytask/templates/profile/view.html b/pytask/templates/profile/view.html index 599cdd8..3779142 100644 --- a/pytask/templates/profile/view.html +++ b/pytask/templates/profile/view.html @@ -1,4 +1,6 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + + {% block content %} Name: {{profile.full_name}} <br /> Username: {{user.username}} <br /> diff --git a/pytask/templates/profile/view_user.html b/pytask/templates/profile/view_user.html index a99e8f7..2115c21 100644 --- a/pytask/templates/profile/view_user.html +++ b/pytask/templates/profile/view_user.html @@ -1,4 +1,6 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + + {% block content %} Name: {{viewing_profile.full_name}} <br /> @@ -16,35 +18,35 @@ Name: {{viewing_profile.full_name}} <br /> {% if comp_tasks %} Tasks completed by {{viewing_profile.full_name}}: <ul> - {% for task in comp_tasks %} - <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> - {% endfor %} + {% for task in comp_tasks %} + <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> + {% endfor %} </ul> {% endif %} {% if working_tasks %} Tasks {{viewing_profile.full_name}} is currently working on: <ul> - {% for task in working_tasks %} - <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> - {% endfor %} + {% for task in working_tasks %} + <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> + {% endfor %} </ul> {% endif %} {% if reviewing_tasks %} Tasks reviewed by {{viewing_profile.full_name}}: <ul> - {% for task in reviewing_tasks %} - <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> - {% endfor %} + {% for task in reviewing_tasks %} + <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> + {% endfor %} </ul> {% endif %} {% if claimed_tasks and can_view_info %} <ul> - {% for task in claimed_tasks %} - <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> - {% endfor %} + {% for task in claimed_tasks %} + <li><a href="{% url view_task task.id %}">{{task.title}}</a></li> + {% endfor %} </ul> {% endif %} |