Django

Code

Changeset 3054

Show
Ignore:
Timestamp:
06/01/06 23:04:04 (2 years ago)
Author:
adrian
Message:

Fixed #2064 -- Added 'Falling back to raw SQL' section to docs/db-api.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/db-api.txt

    r2955 r3054  
    15791579``get_FOO_width()`` methods, where ``FOO`` is the name of the field. This 
    15801580returns the height (or width) of the image, as an integer, in pixels. 
     1581 
     1582Falling back to raw SQL 
     1583======================= 
     1584 
     1585If you find yourself needing to write an SQL query that is too complex for 
     1586Django's database-mapper to handle, you can fall back into raw-SQL statement 
     1587mode. 
     1588 
     1589The preferred way to do this is by giving your model custom methods or custom 
     1590manager methods that execute queries. Although there's nothing in Django that 
     1591*requires* database queries to live in the model layer, this approach keeps all 
     1592your data-access logic in one place, which is smart from an code-organization 
     1593standpoint. For instructions, see `Executing custom SQL`_. 
     1594 
     1595Finally, it's important to note that the Django database layer is merely an 
     1596interface to your database. You can access your database via other tools, 
     1597programming languages or database frameworks; there's nothing Django-specific 
     1598about your database. 
     1599 
     1600.. _Executing custom SQL: http://www.djangoproject.com/documentation/model_api/#executing-custom-sql