I'm trying to create a number of lists depending on the number of weeks there are in a month so for example, we have months that have exactly four weeks as we have months that may surpass that, so my requirement is to create lists dynamically depending the month the users select so the number of list is equal to the weeks in the selected month.
Any pointer would be helpful, thank you
def _get_columns_name(self, options):
# the data type = list
header1 = [
{'name': '', 'style': 'width:90%'},
{'name': _('Week 1'), 'class': 'number', 'colspan': 2},
{'name': options['date']['string'], 'class': 'number', 'colspan': 1},
] + [
{'name': '', 'style': 'width:90%'},
{'name': _('Week 2'), 'class': 'number', 'colspan': 2},
{'name': options['date']['string'], 'class': 'number', 'colspan': 1},
] + [
{'name': '', 'style': 'width:90%'},
{'name': _('Week 3'), 'class': 'number', 'colspan': 2},
{'name': options['date']['string'], 'class': 'number', 'colspan': 1},
] + [
{'name': '', 'style': 'width:90%'},
{'name': _('Week 4'), 'class': 'number', 'colspan': 2},
{'name': options['date']['string'], 'class': 'number', 'colspan': 1},
]
return [header1]
Currently I'm doing this but itdoes not satisfy the requirement correctly.