(self, value)
| 2448 | return self.document_type_obj |
| 2449 | |
| 2450 | def build_lazyref(self, value): |
| 2451 | if isinstance(value, LazyReference): |
| 2452 | if value.passthrough != self.passthrough: |
| 2453 | value = LazyReference( |
| 2454 | value.document_type, value.pk, passthrough=self.passthrough |
| 2455 | ) |
| 2456 | elif value is not None: |
| 2457 | if isinstance(value, self.document_type): |
| 2458 | value = LazyReference( |
| 2459 | self.document_type, value.pk, passthrough=self.passthrough |
| 2460 | ) |
| 2461 | elif isinstance(value, DBRef): |
| 2462 | value = LazyReference( |
| 2463 | self.document_type, value.id, passthrough=self.passthrough |
| 2464 | ) |
| 2465 | else: |
| 2466 | # value is the primary key of the referenced document |
| 2467 | value = LazyReference( |
| 2468 | self.document_type, value, passthrough=self.passthrough |
| 2469 | ) |
| 2470 | return value |
| 2471 | |
| 2472 | def __get__(self, instance, owner): |
| 2473 | """Descriptor to allow lazy dereferencing.""" |
no test coverage detected