add default profile pic

This commit is contained in:
Pierre-antoine Comby 2020-03-03 14:24:07 +01:00
parent 901454f338
commit 211859e940
5 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,7 @@ class Note(PolymorphicModel):
verbose_name=_('display image'),
max_length=255,
blank=True,
default='pic/default.png'
)
created_at = models.DateTimeField(
verbose_name=_('created at'),

BIN
media/pic/default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -92,6 +92,7 @@ TEMPLATES = [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
# 'django.template.context_processors.media',
],
},
},
@ -188,3 +189,5 @@ STATIC_URL = '/static/'
ALIAS_VALIDATOR_REGEX = r''
MEDIA_ROOT=os.path.join(BASE_DIR,"media")
MEDIA_URL='/media/'

View File

@ -1,9 +1,11 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.views.generic import RedirectView
from django.conf.urls.static import static
urlpatterns = [
# Dev so redirect to something random
@ -22,3 +24,5 @@ urlpatterns = [
# Include Django REST API
path('api/', include('api.urls')),
]
urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)

View File

@ -5,7 +5,9 @@
<div class="row mt-4">
<div class="col-md-3 mb-4">
<div class="card bg-light shadow">
<img src="{{ object.note.display_image }}" class="card-img-top" alt="">
<div class="card-top text-center">
<img src="{{ object.note.display_image.url }}" class="img-thumbnail mt-2" >
</div>
<div class="card-body">
<dl class="row">
<dt class="col-xl-6">{% trans 'name'|capfirst %}, {% trans 'first name' %}</dt>