A part of my web app involves creating 'appointments' (shifts) using a drag-and-drop selector for each day. Currently, this data is serialized to something like this:
9,10,11,12,13,14,15,16,76,77,78,298,299,300,301,302,303,304,
Where each number represents the nth half-hour of the week (so 304
is the 300th half-hour of the week, or 8am Saturday).
I then parse this on the server with Python into something a bit more sensible:
[[9,16],[76,78],[298,304]]
But then I am having trouble converting them to datetime
objects neatly, mainly because of how... tacky the data is sent to the server is in the first place.
My question is this: What is the 'best' way to serialize the selected 'shifts' and convert them to datetime
objects with Javascript and Python
I have a live version of the shoddy HTML/Javascript that I came up with. I am using Javascript/jQuery on the client-side, and Python/Django on the server.