Changeset 9314
- Timestamp:
- 11/01/08 14:20:00 (2 months ago)
- Files:
-
- django/trunk/docs/howto/custom-model-fields.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/howto/custom-model-fields.txt
r9258 r9314 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`. … … 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::
