Answer the question
In order to leave comments, you need to log in
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
The simplest is to serialize the clock data in json into a text field. This is if forty-eight boules are not satisfied (:
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()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question