On désactive la localisation qui casse tout

This commit is contained in:
Tom Hubrecht 2021-01-29 23:26:59 +01:00
parent a1c7822a74
commit be324dfcf6
4 changed files with 12 additions and 5 deletions

View file

@ -144,7 +144,7 @@ TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_L10N = False
USE_TZ = True

View file

@ -6,6 +6,11 @@ from fiches.models import Address, Department, Mail, Phone, Profile, Social
class ProfileForm(forms.ModelForm):
birth_date = forms.DateField(
input_formats=["%Y-%m-%d"],
required=False,
)
class Meta:
model = Profile
exclude = ["user"]

View file

@ -1,5 +1,5 @@
{% extends "fiches/base.html" %}
{% load i18n %}
{% load i18n l10n %}
{% block content %}
@ -40,7 +40,9 @@
<div class="birthdate">
<span class="label">{% trans "Date de naissance" %}</span>
<span class="separator"></span>
{% localize on %}
<span class="value">{{ profile.birth_date }}</span>
{% endlocalize %}
</div>
{% endif %}

View file

@ -1,6 +1,5 @@
{% extends "fiches/base.html" %}
{% load i18n %}
{% load static %}
{% load i18n static %}
{% block content %}
@ -121,7 +120,8 @@
<script>
const elem = document.querySelector('input[name="birth_date"]');
const datepicker = new Datepicker(elem, {
format: "dd/mm/yyyy",
format: "yyyy-mm-dd",
defaultViewDate: "{% now '%Y-%m-%d' %}",
});
</script>