1👍
✅
Probably you should create your custom field class to represent idlog, idhandle and idprevious like described here: https://docs.djangoproject.com/en/dev/howto/custom-model-fields/#converting-field-data-for-serialization and put conversion code in body of value_to_string method of the custom field class.
Note: you should call count() on querysets instead of calling .len() because otherwise you’ll have whole datase fetched and inspected to only calculate length.
Also, if you are going to inspect an object length use function len(), it calls len() under the hood for you.
Source:stackexchange.com