[1.6.x] Fixed #19539 -- Updated custom model fields example for Python 3.

Thanks astorije@ for the report.

Backport of b9fceadfd4 from master.