def wm_import(self, wm_staff): address = Address() address.wm_import(wm_staff.address) address.save() self.address = address self.wm_id = wm_staff.id self.username = wm_staff.name self.phone = wm_staff.phone self.mobile = wm_staff.mobile self.email = wm_staff.email self.payrollcode = wm_staff.payrollcode self.save()
def save(self, *args, **kwargs): if not self.address: address = Address() address.save() self.address = address super(Staff, self).save(*args, **kwargs)