Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def form_initial(workmans, need_date):
- my_initial=[]
- for i in workmans:
- my_initial.append({
- 'workshop':i.workshop.name,
- 'team':'' if i.team is None else i.team.name,
- 'username':i.__str__,
- 'workman':str(i.pk),
- 'date':need_date,
- 'hours':'' if i.last_date_record() is None else i.last_date_record().hours,
- 'hours_over_norm':'' if i.last_date_record() is None else i.last_date_record().hours_over_norm,
- })
- # if i.last_date_record() or i == None:
- # my_initial.append({
- # 'workshop':i.workshop.name,
- # 'team':'' if i.team is None else i.team.name,
- # 'username':i.__str__,
- # 'workman':str(i.pk),
- # 'date':need_date,
- # 'hours':i.last_date_record().hours,
- # 'hours_over_norm':i.last_date_record().hours_over_norm,
- # })
- # else:
- # my_initial.append({
- # 'workshop':i.workshop.name,
- # 'team':i.team.name,
- # 'username':i.__str__,
- # 'workman':str(i.pk),
- # 'date':need_date,
- # 'hours':0,
- # 'hours_over_norm':0,
- # })
- return my_initial
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement