Ticket #9412: 9412_r9240_2.diff
File 9412_r9240_2.diff, 1.1 KB (added by , 16 years ago) |
---|
-
docs/howto/custom-model-fields.txt
437 437 438 438 You only need to override this method if you want to preprocess the value 439 439 somehow, just before saving. For example, Django's 440 `:class:`~django.db.models.DateTimeField` uses this method to set the attribute440 :class:`~django.db.models.DateTimeField` uses this method to set the attribute 441 441 correctly in the case of :attr:`~django.db.models.Field.auto_now` or 442 442 :attr:`~django.db.models.Field.auto_now_add`. 443 443 … … 569 569 .. method:: value_to_string(self, obj) 570 570 571 571 This method is used by the serializers to convert the field into a string for 572 output. Calling :meth:` `Field._get_val_from_obj(obj)`` is the best way to get the572 output. Calling :meth:`Field._get_val_from_obj(obj)` is the best way to get the 573 573 value to serialize. For example, since our ``HandField`` uses strings for its 574 574 data storage anyway, we can reuse some existing conversion code:: 575 575