diff --git a/fiches/management/commands/get_photos.py b/fiches/management/commands/get_photos.py
index cb9c30f..cc10bd4 100644
--- a/fiches/management/commands/get_photos.py
+++ b/fiches/management/commands/get_photos.py
@@ -13,7 +13,7 @@ from ._ldap import AnnuaireLDAP
class Command(BaseCommand):
- help = "Si possible, import les photos des conscrit·e·s dans l'annuaire."
+ help = "Si possible, importe les photos des conscrit·e·s dans l'annuaire."
def add_arguments(self, parser):
group = parser.add_mutually_exclusive_group()
diff --git a/fiches/models.py b/fiches/models.py
index 355736f..095620e 100644
--- a/fiches/models.py
+++ b/fiches/models.py
@@ -40,6 +40,10 @@ class Profile(models.Model):
def __str__(self):
return self.full_name
+ @property
+ def age(self):
+ return self.day.year - self.birth_date.year
+
def birthday(self):
return self.birth_date.strftime("%d%m")
diff --git a/fiches/templates/fiches/fiche.html b/fiches/templates/fiches/fiche.html
index 201a7b2..00dc20b 100644
--- a/fiches/templates/fiches/fiche.html
+++ b/fiches/templates/fiches/fiche.html
@@ -106,7 +106,7 @@
{% trans "Champ libre" %}
-
{{ profile.text_field }}
+
{{ profile.text_field|linebreaksbr }}
{% endif %}
diff --git a/fiches/views.py b/fiches/views.py
index e506055..6e061a6 100644
--- a/fiches/views.py
+++ b/fiches/views.py
@@ -2,11 +2,9 @@ from datetime import date, timedelta
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
-from django.db.models import Q
-from django.forms import formset_factory
-from django.forms.models import model_to_dict
+from django.db.models import DateTimeField, Q, Value
from django.http import HttpResponseRedirect
-from django.shortcuts import get_object_or_404, redirect, render
+from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
from django.urls import reverse, reverse_lazy
from django.utils import timezone
@@ -23,7 +21,7 @@ from fiches.forms import (
SearchForm,
SocialFormSet,
)
-from fiches.models import Address, Department, Mail, Phone, Profile, Social
+from fiches.models import Department, Profile
from fiches.utils import get_ldap_infos
@@ -151,14 +149,14 @@ class BirthdayView(ListView):
context["result"] = list(
Profile.objects.filter(
birth_date__day=today.day, birth_date__month=today.month
- )
+ ).annotate(day=Value(today, output_field=DateTimeField()))
)
for i in range(1, 7):
today = today + timedelta(days=1)
context["result"] += list(
Profile.objects.filter(
birth_date__day=today.day, birth_date__month=today.month
- )
+ ).annotate(day=Value(today, output_field=DateTimeField()))
)
return context
diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo
index f0263c1..7748db4 100644
Binary files a/locale/en/LC_MESSAGES/django.mo and b/locale/en/LC_MESSAGES/django.mo differ
diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po
index 79b583e..e611f31 100644
--- a/locale/en/LC_MESSAGES/django.po
+++ b/locale/en/LC_MESSAGES/django.po
@@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-02-23 22:53+0100\n"
-"PO-Revision-Date: 2021-02-23 22:53+0100\n"
-"Last-Translator: Tom Hubrecht