diff --git a/annuaire/urls.py b/annuaire/urls.py index 17f0e1d..b8febf5 100644 --- a/annuaire/urls.py +++ b/annuaire/urls.py @@ -17,12 +17,13 @@ from django.conf import settings from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static -from fiches.views import home +from fiches.views import home, birthday urlpatterns = [ path('admin/', admin.site.urls), path('fiche/', include('fiches.urls')), - path('', home, name='home') + path('', home, name='home'), + path('birthday', birthday, name='birthday') ] if settings.DEBUG: diff --git a/fiches/models.py b/fiches/models.py index 7793fdb..02ff5ab 100644 --- a/fiches/models.py +++ b/fiches/models.py @@ -33,6 +33,9 @@ class Profile(models.Model): def __str__(self): return self.full_name + def birthday(): + return self.birth_date.strftime("%d%m") + class Department(models.Model): name = models.CharField(max_length=255, verbose_name=_("nom du département")) diff --git a/fiches/templates/fiches/base.html b/fiches/templates/fiches/base.html index 9c076eb..0e4fa7b 100644 --- a/fiches/templates/fiches/base.html +++ b/fiches/templates/fiches/base.html @@ -28,7 +28,7 @@ Accueil Modifier sa fiche d'annuaire Consulter sa fiche d'annuaire - Anniversaires à venir + Anniversaires à venir diff --git a/fiches/templates/fiches/birthday.html b/fiches/templates/fiches/birthday.html new file mode 100644 index 0000000..0b30ca5 --- /dev/null +++ b/fiches/templates/fiches/birthday.html @@ -0,0 +1,17 @@ +{% extends "fiches/base.html" %} +{% block content %} + +