apluslms / a-plus

A+ frontend portal - A+ LMS documentation:
https://apluslms.github.io/
Other
67 stars 73 forks source link

Date input validation is missing valid formats #752

Open markkuriekkinen opened 3 years ago

markkuriekkinen commented 3 years ago

Django has many settings for the date formats. They separate output and input formats. Input formats are used in Django forms when they contain date fields.

I was modifying one user record in the Django admin UI. The save failed because the user last login field had an invalid date format. However, I did not modify that field and Django output that exact value itself. There must be something wrong in the new date input validation settings. We modified date formats in the summer 2020: https://github.com/apluslms/a-plus/pull/604

In my case, the Django admin did not accept Finnish date format even though it was first rendered in the Finnish format. I had to manually write the same value in the English format so that I could submit the form without failed validation.

This is very important to fix since it may affect courses and the automatic course import (aplus-json).

https://github.com/apluslms/a-plus/blob/57031587030092ac4c482fde53ff9d9577da0f0f/aplus/en/formats.py#L15 https://github.com/apluslms/a-plus/blob/57031587030092ac4c482fde53ff9d9577da0f0f/aplus/fi/formats.py#L11

jaguarfi commented 3 years ago

I experience the same problem once when I was creating a new course instance. But now, I am not able to replicate the error.

markkuriekkinen commented 3 years ago

Hmm, yes, it looks like the formats.py files already define the needed formats. If the problem does not persist, then we have to assume that it was a temporary glitch and that the current master already has the correct date formats. The server could have had temporary errors if the uwsgi daemon had not loaded all of the current code. Or could this be related to caches? Quite strange at any rate.

It is best to test the date input formats once again before closing this issue.