I have a model called DeviceStatus which has a OneToOne relationship with another model called Device. I want to get the id passed to the DeviceStatus object before saving, but all I get is a ForwardManyToOneDescriptor object.
class DeviceStatus(TimeStampedModel):
device = models.OneToOneField(Device)
# other fields
def __unicode__(self):
return u'{}'.format(self.device)
def copy_to_archive(**kwargs):
print DeviceStatus.device
pre_save.connect(copy_to_archive)
Can somebody guide me through how to get the Device id being passed? TIA