Skip to content
Snippets Groups Projects
Commit fd86389b authored by Dorian Lesbre's avatar Dorian Lesbre
Browse files

Added uploadable planning file

parent 8f96ba71
No related branches found
No related tags found
No related merge requests found
......@@ -195,7 +195,7 @@ I.E we set all dates to the first day (Friday) and set groups allowing vertical
}
</style>
{% if settings.planning_caption %}
<div class="caption">
<p><strong>Légende :</strong></p>
<ul style="list-style-type: none; margin-left:-20px">
......@@ -206,4 +206,6 @@ I.E we set all dates to the first day (Friday) and set groups allowing vertical
<li><span style="background-color: var(--color_6);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> Autre</li>
</ul>
</div>
{% if settings.planning_file %}
<div></div><a class="button" href="{{ settings.planning_file.url }}"><i class="fa fa-download"></i> Télécharger le planning</a></div>
{% endif %}
......@@ -167,6 +167,8 @@
<h2>Prévisualisation du planning</h2>
<p>Vous pouver uploader une version PDF dans le réglages (depuis django-admin)</p>
{% include "_planning.html" %}
<h2>Répartition des activités</h2>
......
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.sitemaps.views import sitemap
from django.views.generic import RedirectView
from django.urls import path, include
......@@ -26,3 +28,6 @@ urlpatterns = [
),
path('accounts/', include("accounts.urls")),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......@@ -173,6 +173,9 @@ USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
LOGIN_URL = "accounts:login"
LOGIN_REDIRECT_URL = "accounts:profile"
......
......@@ -14,4 +14,9 @@ class SingletonModelAdmin(admin.ModelAdmin):
@admin.register(SiteSettings)
class SiteSettingsAdmin(SingletonModelAdmin):
pass
\ No newline at end of file
def planning_file_link(self, obj):
if obj.file:
return "<a href='%s'>download</a>" % (obj.file.url,)
else:
return "No attachment"
# Generated by Django 3.0.8 on 2021-04-25 14:43
# Generated by Django 3.0.8 on 2021-04-25 15:32
from django.db import migrations
from django.db import migrations, models
class Migration(migrations.Migration):
......@@ -14,4 +14,9 @@ class Migration(migrations.Migration):
model_name='sitesettings',
name='planning_caption',
),
migrations.AddField(
model_name='sitesettings',
name='planning_file',
field=models.FileField(blank=True, null=True, upload_to='', verbose_name='Version PDF du planning'),
),
]
......@@ -52,6 +52,9 @@ class SiteSettings(SingletonModel):
)
display_planning = models.BooleanField("Afficher le planning", default=False)
planning_file = models.FileField(
verbose_name="Version PDF du planning", null=True, blank=True,
)
activities_allocated = models.BooleanField(
"Afficher les activités obtenues", default=False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment