Commit 768548d0 authored by fred.perso's avatar fred.perso

Merge branch 'downloadable_file_session' into 'master'

[Fiche session]  link for file

See merge request !13
parents 01aeb59d 86605fc8
import datetime
import os.path
from django.conf import settings
from django.contrib.auth.models import User
......@@ -453,6 +454,10 @@ class Session(models.Model):
updated_by = models.ForeignKey(
settings.AUTH_USER_MODEL, null=True, db_index=True, editable=False, related_name='session_modifier')
@property
def data_filename(self):
return os.path.basename(self.data_file.name)
def __str__(self):
return "%s ∙ %s ∙ %s" % (
self.place, datetime.date(self.date_start.year, self.date_start.month, self.date_start.day), self.contact)
......
{% extends 'base_fullwidth_leaflet.html' %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load static %}
{% block content %}
<h1><i class="{{ icon | safe }}"></i> {{ title | safe }}</h1>
<p>
......@@ -131,7 +132,7 @@
<div class="row">
<div class="col-lg-12">
<label>Fichiers relatifs à la session</label>
<div class="well well-sm">{{ object.data_file }}</div>
<div class="well well-sm"><a href="{% get_media_prefix %}/{{ object.data_file }}" target='_blank'> {{ object.data_filename }}</a></div>
</div>
</div>
</fieldset>
......
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