0002-agendas-add-weekday-indexes-to-time-period-45159.patch
chrono/agendas/migrations/0110_timeperiod_weekday_indexes.py | ||
---|---|---|
1 |
# Generated by Django 2.2.19 on 2022-03-10 11:03 |
|
2 | ||
3 |
import django.contrib.postgres.fields |
|
4 |
from django.db import migrations, models |
|
5 | ||
6 | ||
7 |
class Migration(migrations.Migration): |
|
8 | ||
9 |
dependencies = [ |
|
10 |
('agendas', '0109_auto_20220203_1051'), |
|
11 |
] |
|
12 | ||
13 |
operations = [ |
|
14 |
migrations.AddField( |
|
15 |
model_name='timeperiod', |
|
16 |
name='weekday_indexes', |
|
17 |
field=django.contrib.postgres.fields.ArrayField( |
|
18 |
base_field=models.IntegerField( |
|
19 |
choices=[ |
|
20 |
(1, 'First of the month'), |
|
21 |
(2, 'Second of the month'), |
|
22 |
(3, 'Third of the month'), |
|
23 |
(4, 'Fourth of the month'), |
|
24 |
(5, 'Fifth of the month'), |
|
25 |
] |
|
26 |
), |
|
27 |
blank=True, |
|
28 |
null=True, |
|
29 |
size=None, |
|
30 |
verbose_name='Repeat', |
|
31 |
), |
|
32 |
), |
|
33 |
] |
chrono/agendas/models.py | ||
---|---|---|
1157 | 1157 |
) |
1158 | 1158 | |
1159 | 1159 | |
1160 |
WEEK_CHOICES = [ |
|
1161 |
(1, _('First of the month')), |
|
1162 |
(2, _('Second of the month')), |
|
1163 |
(3, _('Third of the month')), |
|
1164 |
(4, _('Fourth of the month')), |
|
1165 |
(5, _('Fifth of the month')), |
|
1166 |
] |
|
1167 | ||
1168 | ||
1160 | 1169 |
class TimePeriod(models.Model): |
1161 | 1170 |
weekday = models.IntegerField(_('Week day'), choices=WEEKDAYS_LIST) |
1171 |
weekday_indexes = ArrayField( |
|
1172 |
models.IntegerField(choices=WEEK_CHOICES), |
|
1173 |
verbose_name=_('Repeat'), |
|
1174 |
blank=True, |
|
1175 |
null=True, |
|
1176 |
) |
|
1162 | 1177 |
start_time = models.TimeField(_('Start')) |
1163 | 1178 |
end_time = models.TimeField(_('End')) |
1164 | 1179 |
desk = models.ForeignKey('Desk', on_delete=models.CASCADE, null=True) |
1165 |
- |