Here i am getting a list of dates check whether the day is sunday or not
date_list = ['2023-03-17', '2023-03-18', '2023-03-19', '2023-03-20']
if date is sunday i need to create my table record where capacity is 0 and if not sunday i need to create record with capacity as 10
for date in date_list: if date.weekday() > 5: people = '5' capacity = 0 ProductionCapacity.objects.create(num_of_people=people,date=date,capacity=capacity) else: people = '15' capacity = 10 ProductionCapacity.objects.create(num_of_people=people,date=date,capacity=capacity)