H
H
hardwellZero2015-01-20 15:29:28
Django
hardwellZero, 2015-01-20 15:29:28

How to store working hours?

It is necessary to store the working hours of the store (for a week)
Mon-Tue-Wed-Thurs-Fri-Sat-Sun
For example: Wednesday, from 9:00 to 10:30, from 11:00 to 16:00, from 16:30 to 20 :00
Every day can be different.
We decided that we would take into account every half hour of work / not work.
1 - work
0 - not work
There are 48 values ​​per day.
Actually, I need help with the model of this.
Thanks in advance for your time.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
yttrium, 2015-01-20
@yttrium

The simplest is to serialize the clock data in json into a text field. This is if forty-eight boules are not satisfied (:

A
Alexey Cheremisin, 2015-01-20
@leahch

And what not to store an interval? And it is possible to generate through dateutil for any date.
Use rrule and rruleset from this package and you will get dates/times for any date. You only need to make two lists in your case - one time for opening and one for closing. Actually, these two lists can be repacked via zip()

R
radioxoma, 2015-01-20
@radioxoma

You might be interested in this page on the OSM Wiki .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question