diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
index 54913a8..85c7100 100644
a
|
b
|
appropriate Python object. The details of how this happens internally are a
|
249 | 249 | little complex, but the code you need to write in your ``Field`` class is |
250 | 250 | simple: make sure your field subclass uses a special metaclass: |
251 | 251 | |
252 | | For example:: |
| 252 | For example, on Python 2:: |
253 | 253 | |
254 | 254 | class HandField(models.Field): |
255 | 255 | |
… |
… |
For example::
|
258 | 258 | __metaclass__ = models.SubfieldBase |
259 | 259 | |
260 | 260 | def __init__(self, *args, **kwargs): |
261 | | # ... |
| 261 | ... |
| 262 | |
| 263 | On Python 3, in lieu of setting the ``__metaclass__`` attribute, add |
| 264 | ``metaclass`` to the class definition:: |
| 265 | |
| 266 | class HandField(models.Field, metaclass=models.SubfieldBase): |
| 267 | ... |
| 268 | |
| 269 | If you want your code to work on Python 2 & 3, you can use |
| 270 | :func:`six.with_metaclass`:: |
| 271 | |
| 272 | from django.utils.six import with_metaclass |
| 273 | |
| 274 | class HandField(with_metaclass(models.SubfieldBase, models.Field)): |
| 275 | ... |
262 | 276 | |
263 | 277 | This ensures that the :meth:`.to_python` method, documented below, will always |
264 | 278 | be called when the attribute is initialized. |