1 | | There's a difference between lookup against the database (e.g. `filter(pet_id=str(pet.id))`) which performs implicit conversions and direct model attribute assignments. I would argue that if you explicitly assign the string representation of objects meant to be stored in a field to a model instance you are effectively doing things wrong. |
| 1 | There's a difference between lookup against the database (e.g. `filter(pet_id=str(pet.id))`) which performs implicit conversions and direct model attribute assignments. I would argue that if you explicitly assign the string representation of objects meant to be stored in a field to a model instance you are effectively doing something wrong. |
| 2 | |
| 3 | One concrete example of that is model equality `Model.__eq__` which is implemented by comparing the bases and the primary key value of the compared objects. Since `value = uuid.uuid4(); value != str(value)` then `Object(pk=value) != Object(pk=str(value))`. |
| 4 | |
| 5 | I don't think it's attainable to have the ORM to perform type conversion every time it needs to perform equality checks. |