diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2014-01-03 01:30:52 -0800 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2014-01-03 01:30:52 -0800 |
| commit | 4e6142ee84e966418799fed1fc5d8594a9e08c02 (patch) | |
| tree | 92ba7d2cb265961bfee155ddd04c6155e94c98db | |
| parent | ea83102d0f0c215ae2bd16a2c8c474ce615bad9a (diff) | |
| parent | 1a9f13df59e83eb6e0c20f96d878826519eca62a (diff) | |
Merge pull request #2094 from coder9042/ticket_21478
Changed documentation for db_type()
| -rw-r--r-- | docs/howto/custom-model-fields.txt | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt index 6054a83f10..b7bcefad53 100644 --- a/docs/howto/custom-model-fields.txt +++ b/docs/howto/custom-model-fields.txt @@ -458,11 +458,14 @@ For example:: else: return 'timestamp' -The :meth:`.db_type` method is only called by Django when the framework +The :meth:`.db_type` method is called by Django when the framework constructs the ``CREATE TABLE`` statements for your application -- that is, -when you first create your tables. It's not called at any other time, so it can -afford to execute slightly complex code, such as the -``connection.settings_dict`` check in the above example. +when you first create your tables. It is also called when constructing a +``WHERE`` clause that includes the model field -- that is, when you retrieve data +using QuerySet methods like ``get()``, ``filter()``, and ``exclude()`` and have +the model field as an argument. It's not called at any other time, so it can afford to +execute slightly complex code, such as the ``connection.settings_dict`` check in +the above example. Some database column types accept parameters, such as ``CHAR(25)``, where the parameter ``25`` represents the maximum column length. In cases like these, |
