-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_shortened_periods.py
56 lines (53 loc) · 1.31 KB
/
add_shortened_periods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from timetable.models import Schedule, Period
from datetime import time
periods = [
{
'number': 0,
'begin_time': time(7, 25),
'end_time': time(7, 55)
},
{
'number': 1,
'begin_time': time(8, 00),
'end_time': time(8, 30)
},
{
'number': 2,
'begin_time': time(8, 40),
'end_time': time(9, 10)
},
{
'number': 3,
'begin_time': time(9, 20),
'end_time': time(9, 50)
},
{
'number': 4,
'begin_time': time(10, 5),
'end_time': time(10, 35)
},
{
'number': 5,
'begin_time': time(10, 45),
'end_time': time(11, 15)
},
{
'number': 6,
'begin_time': time(11, 25),
'end_time': time(11, 55)
},
{
'number': 7,
'begin_time': time(12, 5),
'end_time': time(12, 35)
},
{
'number': 8,
'begin_time': time(12, 40),
'end_time': time(13, 10)
},
]
Schedule.objects.filter(name='skrócone lekcje').delete()
shortened = Schedule(name='skrócone lekcje', is_default=None)
shortened.save()
Period.objects.bulk_create([Period(schedule=shortened, **kwargs) for kwargs in periods])