def create_documents(self): """Create all the corresponding documents for this payroll """ self.pdf = PayrollPDF(payroll=self, start_date=self.start_date, end_date=self.end_date) self.pdf.create() return self.pdf
class Payroll(models.Model): start_date = models.DateField(null=False) end_date = models.DateField(null=False) objects = PayrollManager() def create_documents(self): """Create all the corresponding documents for this payroll """ self.pdf = PayrollPDF(payroll=self, start_date=self.start_date, end_date=self.end_date) self.pdf.create() return self.pdf