Display avatars on committee page

See #13
parent f77fec51
{% extends "base.html" %}
{% load i18n %}
{% load i18n static %}
{% block title %}{{ committee.name }} — {% trans 'Committees' %} — {{ block.super }}{% endblock %}
{% block page_title %}{% trans 'Committees' %}{% endblock %}
......@@ -29,7 +29,11 @@
<a href="{{ member.get_absolute_url }}">
<div class="post-inner">
<div class="inner-img">
<img alt="{{ member.display_name }}" src="//www.gravatar.com/avatar/c36272792e1f9c7f9427c3a83f330b0e?s=620&d=mm&r=g">
{% if not member.photo %}
<img alt="{% trans "Default avatar" %}" src="{% static 'members/images/default-avatar.jpg' %}" height="620" width="620" />
{% else %}
<img alt="{{ member.display_name }}" src="{{ MEDIA_URL }}{{ member.photo }}" width="620" height="620" />
{% endif %}
</div>
{% if member.chair %}
<div class="ribbon-wrapper-basiskleur">
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10rc1 on 2016-07-27 20:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0001_squashed_0002_auto_20160707_1512'),
]
operations = [
migrations.AddField(
model_name='member',
name='photo',
field=models.ImageField(blank=True, null=True, upload_to='public/avatars/', verbose_name='Foto'),
),
]
......@@ -176,6 +176,13 @@ class Member(models.Model):
default='full',
)
photo = models.ImageField(
verbose_name=_('Foto'),
upload_to='public/avatars/',
null=True,
blank=True,
)
# --- Communication preference ----
language = models.CharField(
......
This diff was suppressed by a .gitattributes entry.
......@@ -147,7 +147,7 @@ LOCALE_PATHS = ('locale',)
# Where to store uploaded files
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/public/'
MEDIA_URL = '/media/' # Public is included by the db fields
SENDFILE_BACKEND = 'sendfile.backends.development'
......
......@@ -38,5 +38,5 @@ urlpatterns = [
# Default login helpers
url(r'^', include('django.contrib.auth.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
] + static(settings.MEDIA_URL,
] + static(settings.MEDIA_URL + 'public/',
document_root=os.path.join(settings.MEDIA_ROOT, 'public'))
Markdown is supported
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