Merge pull request #2094 from coder9042/ticket_21478

Changed documentation for db_type()
This commit is contained in:
Anssi Kääriäinen 2014-01-03 01:30:52 -08:00
commit 4e6142ee84
1 changed files with 7 additions and 4 deletions

View File

@ -458,11 +458,14 @@ For example::
else: else:
return 'timestamp' 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, 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 when you first create your tables. It is also called when constructing a
afford to execute slightly complex code, such as the ``WHERE`` clause that includes the model field -- that is, when you retrieve data
``connection.settings_dict`` check in the above example. 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 Some database column types accept parameters, such as ``CHAR(25)``, where the
parameter ``25`` represents the maximum column length. In cases like these, parameter ``25`` represents the maximum column length. In cases like these,