Added personal photo+bio pages.
- Legacy-Id: 11278
This commit is contained in:
parent
5159349959
commit
c4b59f0363
|
@ -1,7 +1,8 @@
|
|||
from django.conf.urls import patterns
|
||||
from ietf.person import ajax
|
||||
from ietf.person import views, ajax
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^search/(?P<model_name>(person|email))/$', "ietf.person.views.ajax_select2_search", None, 'ajax_select2_search_person_email'),
|
||||
(r'^(?P<personid>[a-z0-9]+).json$', ajax.person_json),
|
||||
(ur'^(?P<email_or_name>[\w\s]+)', views.profile),
|
||||
)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from django.http import HttpResponse
|
||||
from django.db.models import Q
|
||||
|
||||
from ietf.person.models import Email, Person
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
|
||||
from ietf.person.models import Email, Person, Alias
|
||||
from ietf.person.fields import select2_id_name_json
|
||||
|
||||
def ajax_select2_search(request, model_name):
|
||||
|
@ -47,3 +49,11 @@ def ajax_select2_search(request, model_name):
|
|||
objs = objs.distinct()[page:page + 10]
|
||||
|
||||
return HttpResponse(select2_id_name_json(objs), content_type='application/json')
|
||||
|
||||
def profile(request, email_or_name):
|
||||
person = None
|
||||
if '@' in email_or_name:
|
||||
person = get_object_or_404(Email, address=email_or_name).person
|
||||
else:
|
||||
person = get_object_or_404(Alias, name=email_or_name).person
|
||||
return render(request, 'person/profile.html', {'person': person})
|
||||
|
|
|
@ -464,6 +464,14 @@ label#list-feeds {
|
|||
height: 3em;
|
||||
}
|
||||
|
||||
.bio-text {
|
||||
max-width: 85ex;
|
||||
}
|
||||
.bio-photo {
|
||||
float: left;
|
||||
margin: 0.3em 1em 0.5em 0.1em;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a {
|
||||
background-color: #f8f8f8;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<div class="photo-name">
|
||||
{% if person_with_groups.grouper.photo %}
|
||||
<a href="{{person_with_groups.grouper.photo.url}}"><strong>{{person_with_groups.grouper.plain_name}}</strong></a>
|
||||
<a href="{% url 'ietf.person.views.profile' email_or_name=person_with_groups.grouper.name %}"><strong>{{person_with_groups.grouper.plain_name}}</strong></a>
|
||||
{% else %}
|
||||
<strong>{{person_with_groups.grouper.plain_name}}</strong>
|
||||
{% endif %}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</div>
|
||||
<div class="photo-name">
|
||||
{% if person_with_groups.grouper.photo %}
|
||||
<a href="{{person_with_groups.grouper.photo.url}}"><strong>{{person_with_groups.grouper.plain_name}}</strong></a>
|
||||
<a href="{% url 'ietf.person.views.profile' email_or_name=person_with_groups.grouper.name %}"><strong>{{person_with_groups.grouper.plain_name}}</strong></a>
|
||||
{% else %}
|
||||
<strong>{{person_with_groups.grouper.plain_name}}</strong>
|
||||
{% endif %}
|
||||
|
|
17
ietf/templates/person/profile.html
Normal file
17
ietf/templates/person/profile.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% extends "base.html" %}
|
||||
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||
{% load origin %}
|
||||
|
||||
{% block title %}Profile for {{ person }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% origin %}
|
||||
<h1>{{ person }}</h1>
|
||||
|
||||
<div class="bio-text">
|
||||
<img class="bio-photo" src="{{ person.photo.url }}" alt="Photo of {{ person }}" />
|
||||
{{ person.biography }}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in a new issue