Ticket #14638: 14638.diff

File 14638.diff, 1.6 KB (added by ANUBHAV JOSHI, 10 years ago)
  • docs/howto/custom-model-fields.txt

    diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
    index 75d14e6..9f9fab1 100644
    a b If you want your code to work on Python 2 & 3, you can use  
    362362    class HandField(with_metaclass(models.SubfieldBase, models.Field)):
    363363        ...
    364364
    365 This ensures that the :meth:`.to_python` method, documented below, will always
     365This ensures that the :meth:`.to_python` method, will always
    366366be called when the attribute is initialized.
    367367
    368368ModelForms and custom fields
    369369~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    370370
    371371If you use :class:`~django.db.models.SubfieldBase`, :meth:`.to_python`
    372 will be called every time an instance of the field is assigned a
     372apart from its usual call when getting the value from the database,
     373will also be called every time an instance of the field is assigned a
    373374value. This means that whenever a value may be assigned to the field,
    374375you need to ensure that it will be of the correct datatype, or that
    375376you handle any exceptions.
  • docs/ref/models/fields.txt

    diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
    index 9c58505..bcc5ead 100644
    a b Field API reference  
    16151615        The default implementation returns ``value``, which is the common case
    16161616        when the database backend already returns the correct Python type.
    16171617
    1618         See :ref:`converting-database-values-to-python-objects` for usage.
     1618        See :ref:`converting-database-values-to-python-objects` for various usages.
    16191619
    16201620    When saving, :meth:`pre_save` and :meth:`get_db_prep_save` are used:
    16211621
Back to Top