Browse Source
Ajout de fontawesome pour les icônes Ajout d'un bouton de déconnexion sur la page principale Ajout de la redirection après login dans settings.py Ajout de la gestion des erreurs 404 et 500 avec des pages personnalisées Ajout de DataTables pour la gestion des tableaux dans course_detail.htmlmaster
17 changed files with 230 additions and 31 deletions
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
from django import template |
||||
|
||||
register = template.Library() |
||||
|
||||
import datetime |
||||
|
||||
def seconds_to_hms(value): |
||||
try: |
||||
# Si value est un datetime, on convertit en secondes |
||||
if isinstance(value, datetime.timedelta): |
||||
total_seconds = int(value.total_seconds()) |
||||
elif isinstance(value, datetime.datetime): |
||||
# Si value est un datetime, on prend l'heure/min/sec |
||||
total_seconds = value.hour * 3600 + value.minute * 60 + value.second |
||||
else: |
||||
total_seconds = int(value) |
||||
h = total_seconds // 3600 |
||||
m = (total_seconds % 3600) // 60 |
||||
s = total_seconds % 60 |
||||
return f"{h:02}h{m:02}m{s:02}s" |
||||
except (ValueError, TypeError, AttributeError): |
||||
return "--:--:--" |
||||
|
||||
register.filter('seconds_to_hms', seconds_to_hms) |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
/*! DataTables Bootstrap 4 integration |
||||
* ©2011-2017 SpryMedia Ltd - datatables.net/license |
||||
*/ |
||||
!function(t){var n,o;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(n=require("jquery"),o=function(e,a){a.fn.dataTable||require("datatables.net")(e,a)},"undefined"==typeof window?module.exports=function(e,a){return e=e||window,a=a||n(e),o(e,a),t(a,0,e.document)}:(o(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(x,e,n,o){"use strict";var r=x.fn.dataTable;return x.extend(!0,r.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",renderer:"bootstrap"}),x.extend(r.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"}),r.ext.renderer.pageButton.bootstrap=function(i,e,d,a,l,c){function u(e,a){for(var t,n,o=function(e){e.preventDefault(),x(e.currentTarget).hasClass("disabled")||m.page()==e.data.action||m.page(e.data.action).draw("page")},r=0,s=a.length;r<s;r++)if(t=a[r],Array.isArray(t))u(e,t);else{switch(f=p="",t){case"ellipsis":p="…",f="disabled";break;case"first":p=g.sFirst,f=t+(0<l?"":" disabled");break;case"previous":p=g.sPrevious,f=t+(0<l?"":" disabled");break;case"next":p=g.sNext,f=t+(l<c-1?"":" disabled");break;case"last":p=g.sLast,f=t+(l<c-1?"":" disabled");break;default:p=t+1,f=l===t?"active":""}p&&(n=-1!==f.indexOf("disabled"),n=x("<li>",{class:b.sPageButton+" "+f,id:0===d&&"string"==typeof t?i.sTableId+"_"+t:null}).append(x("<a>",{href:n?null:"#","aria-controls":i.sTableId,"aria-disabled":n?"true":null,"aria-label":w[t],role:"link","aria-current":"active"===f?"page":null,"data-dt-idx":t,tabindex:n?-1:i.iTabIndex,class:"page-link"}).html(p)).appendTo(e),i.oApi._fnBindAction(n,{action:t},o))}}var p,f,t,m=new r.Api(i),b=i.oClasses,g=i.oLanguage.oPaginate,w=i.oLanguage.oAria.paginate||{};try{t=x(e).find(n.activeElement).data("dt-idx")}catch(e){}u(x(e).empty().html('<ul class="pagination"/>').children("ul"),a),t!==o&&x(e).find("[data-dt-idx="+t+"]").trigger("focus")},r}); |
||||
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
/*! DataTables French translation - v1.10.20 */ |
||||
$.extend(true, $.fn.dataTable.defaults, { |
||||
language: { |
||||
url: "https://cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json" |
||||
} |
||||
}); |
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 696 B |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %} |
||||
{% block content %} |
||||
<div class="container mt-5 text-center"> |
||||
<h1 class="display-4 text-danger">Erreur 404</h1> |
||||
<p class="lead">La page demandée n'existe pas ou a été déplacée.</p> |
||||
<a href="/" class="btn btn-primary">Retour à l'accueil</a> |
||||
</div> |
||||
{% endblock %} |
||||
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %} |
||||
{% block content %} |
||||
<div class="container mt-5 text-center"> |
||||
<h1 class="display-4 text-danger">Erreur 500</h1> |
||||
<p class="lead">Une erreur interne est survenue. Veuillez réessayer plus tard.</p> |
||||
<a href="/" class="btn btn-primary">Retour à l'accueil</a> |
||||
</div> |
||||
{% endblock %} |
||||
Loading…
Reference in new issue