This is a mock object, used for when we only need the pk of the object instance, but still want to return an object with a .pk attribute, in order to keep the same interface as a regular model instance.
| 66 | |
| 67 | |
| 68 | class PKOnlyObject: |
| 69 | """ |
| 70 | This is a mock object, used for when we only need the pk of the object |
| 71 | instance, but still want to return an object with a .pk attribute, |
| 72 | in order to keep the same interface as a regular model instance. |
| 73 | """ |
| 74 | |
| 75 | def __init__(self, pk): |
| 76 | self.pk = pk |
| 77 | |
| 78 | def __str__(self): |
| 79 | return "%s" % self.pk |
| 80 | |
| 81 | |
| 82 | # We assume that 'validators' are intended for the child serializer, |
no outgoing calls