def estimation(project, user, customer, company, phase): est = Estimation( company, customer, project, phase, user, ) for key, value in ESTIMATION.items(): setattr(est, key, value) for line in LINES: est.add_line(TaskLine(**line)) for line in DISCOUNTS: est.discounts.append(DiscountLine(**line)) for line in PAYMENT_LINES: est.payment_lines.append(PaymentLine(**line)) est.mentions = [ TaskMention(label='mention1', title='title1', full_text='text1') ] return est