Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
03d3cdb9
Unverified
Commit
03d3cdb9
authored
Jul 27, 2016
by
Thom Wiggers
📐
Browse files
Display avatars on committee page
See
#13
parent
f77fec51
Changes
6
Hide whitespace changes
Inline
Side-by-side
website/committees/templates/committees/details.html
View file @
03d3cdb9
{% 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"
>
...
...
website/members/migrations/0002_member_photo.py
0 → 100644
View file @
03d3cdb9
# -*- 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'
),
),
]
website/members/models.py
View file @
03d3cdb9
...
...
@@ -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
(
...
...
website/members/static/members/images/default-avatar.jpg
0 → 100644
View file @
03d3cdb9
11.1 KB
website/thaliawebsite/settings/settings.py
View file @
03d3cdb9
...
...
@@ -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'
...
...
website/thaliawebsite/urls.py
View file @
03d3cdb9
...
...
@@ -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'
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment