mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
boulder-oracle-sprint: Merged to [5013]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5014 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
56
docs/databrowse.txt
Normal file
56
docs/databrowse.txt
Normal file
@@ -0,0 +1,56 @@
|
||||
==========
|
||||
Databrowse
|
||||
==========
|
||||
|
||||
Databrowse is a Django application that lets you browse your data.
|
||||
|
||||
As the Django admin dynamically creates an admin interface by introspecting
|
||||
your models, Databrowse dynamically creates a rich, browsable Web site by
|
||||
introspecting your models.
|
||||
|
||||
.. admonition:: Note
|
||||
|
||||
Databrowse is **very** new and is currently under active development. It
|
||||
may change substantially before the next Django release.
|
||||
|
||||
With that said, it's easy to use, and it doesn't require writing any
|
||||
code. So you can play around with it today, with very little investment in
|
||||
time or coding.
|
||||
|
||||
How to use Databrowse
|
||||
=====================
|
||||
|
||||
1. Point Django at the default Databrowse templates. There are two ways to
|
||||
do this:
|
||||
|
||||
* Add ``'django.contrib.databrowse'`` to your ``INSTALLED_APPS``
|
||||
setting. This will work if your ``TEMPLATE_LOADERS`` setting includes
|
||||
the ``app_directories`` template loader (which is the case by
|
||||
default). See the `template loader docs`_ for more.
|
||||
|
||||
* Otherwise, determine the full filesystem path to the
|
||||
``django/contrib/databrowse/templates`` directory, and add that
|
||||
directory to your ``TEMPLATE_DIRS`` setting.
|
||||
|
||||
2. Register a number of models with the Databrowse site::
|
||||
|
||||
from django.contrib import databrowse
|
||||
|
||||
databrowse.site.register(SomeModel)
|
||||
databrowse.site.register(SomeOtherModel)
|
||||
|
||||
Note that you should register the model *classes*, not instances.
|
||||
|
||||
It doesn't matter where you put this, as long as it gets executed at
|
||||
some point. A good place for it is in your URLconf file (``urls.py``).
|
||||
|
||||
3. Add the following line to your URLconf::
|
||||
|
||||
(r'^databrowse/(.*)', databrowse.site.root),
|
||||
|
||||
The prefix doesn't matter -- you can use ``databrowse/`` or ``db/`` or
|
||||
whatever you'd like.
|
||||
|
||||
4. Run the Django server and visit ``/databrowse/`` in your browser.
|
||||
|
||||
.. _template loader docs: ../templates_python/#loader-types
|
||||
@@ -332,7 +332,7 @@ sqlall [appname appname ...]
|
||||
|
||||
Prints the CREATE TABLE and initial-data SQL statements for the given appnames.
|
||||
|
||||
Refer to the description of ``sqlinitialdata`` for an explanation of how to
|
||||
Refer to the description of ``sqlcustom`` for an explanation of how to
|
||||
specify initial data.
|
||||
|
||||
sqlclear [appname appname ...]
|
||||
|
||||
@@ -58,6 +58,7 @@ installed.
|
||||
If you're on Windows, check out the unofficial `compiled Windows version`_.
|
||||
|
||||
* If you're using MySQL, you'll need MySQLdb_, version 1.2.1p2 or higher.
|
||||
You will also want to read the database-specific notes for the `MySQL backend`_.
|
||||
|
||||
* If you're using SQLite, you'll need pysqlite_. Use version 2.0.3 or higher.
|
||||
|
||||
@@ -69,6 +70,7 @@ installed.
|
||||
.. _MySQLdb: http://sourceforge.net/projects/mysql-python
|
||||
.. _SQLite: http://www.sqlite.org/
|
||||
.. _pysqlite: http://initd.org/tracker/pysqlite
|
||||
.. _MySQL backend: ../databases/
|
||||
|
||||
Remove any old versions of Django
|
||||
=================================
|
||||
|
||||
@@ -21,7 +21,7 @@ A companion to this document is the `official repository of model examples`_.
|
||||
(In the Django source distribution, these examples are in the
|
||||
``tests/modeltests`` directory.)
|
||||
|
||||
.. _Database API reference: http://www.djangoproject.com/documentation/db_api/
|
||||
.. _Database API reference: ../db-api/
|
||||
.. _official repository of model examples: http://www.djangoproject.com/documentation/models/
|
||||
|
||||
Quick example
|
||||
@@ -57,7 +57,7 @@ Some technical notes:
|
||||
syntax, but it's worth noting Django uses SQL tailored to the database
|
||||
backend specified in your `settings file`_.
|
||||
|
||||
.. _settings file: http://www.djangoproject.com/documentation/settings/
|
||||
.. _settings file: ../settings/
|
||||
|
||||
Fields
|
||||
======
|
||||
@@ -501,7 +501,7 @@ For each model field that has ``choices`` set, Django will add a method to
|
||||
retrieve the human-readable name for the field's current value. See
|
||||
`get_FOO_display`_ in the database API documentation.
|
||||
|
||||
.. _get_FOO_display: ../db_api/#get-foo-display
|
||||
.. _get_FOO_display: ../db-api/#get-foo-display
|
||||
|
||||
Finally, note that choices can be any iterable object -- not necessarily a
|
||||
list or tuple. This lets you construct choices dynamically. But if you find
|
||||
@@ -626,7 +626,7 @@ that takes the parameters ``field_data, all_data`` and raises
|
||||
|
||||
Django comes with quite a few validators. They're in ``django.core.validators``.
|
||||
|
||||
.. _validator docs: http://www.djangoproject.com/documentation/forms/#validators
|
||||
.. _validator docs: ../forms/#validators
|
||||
|
||||
Verbose field names
|
||||
-------------------
|
||||
@@ -792,8 +792,8 @@ relationship should work. All are optional:
|
||||
the related object.
|
||||
======================= ============================================================
|
||||
|
||||
.. _`Database API reference`: http://www.djangoproject.com/documentation/db_api/
|
||||
.. _related objects documentation: http://www.djangoproject.com/documentation/db_api/#related-objects
|
||||
.. _`Database API reference`: ../db-api/
|
||||
.. _related objects documentation: ../db-api/#related-objects
|
||||
|
||||
Many-to-many relationships
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -963,7 +963,7 @@ Example::
|
||||
|
||||
See the `docs for latest()`_ for more.
|
||||
|
||||
.. _docs for latest(): http://www.djangoproject.com/documentation/db_api/#latest-field-name-none
|
||||
.. _docs for latest(): ../db-api/#latest-field-name-none
|
||||
|
||||
``order_with_respect_to``
|
||||
-------------------------
|
||||
@@ -1397,7 +1397,7 @@ if one of the ``list_display`` fields is a ``ForeignKey``.
|
||||
|
||||
For more on ``select_related()``, see `the select_related() docs`_.
|
||||
|
||||
.. _the select_related() docs: http://www.djangoproject.com/documentation/db_api/#select-related
|
||||
.. _the select_related() docs: ../db-api/#select-related
|
||||
|
||||
``ordering``
|
||||
------------
|
||||
@@ -1502,7 +1502,7 @@ The way ``Manager`` classes work is documented in the `Retrieving objects`_
|
||||
section of the database API docs, but this section specifically touches on
|
||||
model options that customize ``Manager`` behavior.
|
||||
|
||||
.. _Retrieving objects: http://www.djangoproject.com/documentation/db_api/#retrieving-objects
|
||||
.. _Retrieving objects: ../db-api/#retrieving-objects
|
||||
|
||||
Manager names
|
||||
-------------
|
||||
@@ -1825,7 +1825,7 @@ just the ``where``, ``tables`` and ``params`` arguments to the standard lookup
|
||||
API. See `Other lookup options`_.
|
||||
|
||||
.. _Python DB-API: http://www.python.org/peps/pep-0249.html
|
||||
.. _Other lookup options: http://www.djangoproject.com/documentation/db_api/#extra-params-select-where-tables
|
||||
.. _Other lookup options: ../db-api/#extra-params-select-where-tables
|
||||
|
||||
Overriding default model methods
|
||||
--------------------------------
|
||||
@@ -1858,7 +1858,7 @@ You can also prevent saving::
|
||||
else:
|
||||
super(Blog, self).save() # Call the "real" save() method.
|
||||
|
||||
.. _database API docs: http://www.djangoproject.com/documentation/db_api/
|
||||
.. _database API docs: ../db-api/
|
||||
|
||||
Models across files
|
||||
===================
|
||||
@@ -1915,7 +1915,7 @@ Each SQL file, if given, is expected to contain valid SQL. The SQL files are
|
||||
piped directly into the database after all of the models' table-creation
|
||||
statements have been executed.
|
||||
|
||||
The SQL files are read by the ``sqlinitialdata``, ``sqlreset``, ``sqlall`` and
|
||||
The SQL files are read by the ``sqlcustom``, ``sqlreset``, ``sqlall`` and
|
||||
``reset`` commands in ``manage.py``. Refer to the `manage.py documentation`_
|
||||
for more information.
|
||||
|
||||
@@ -1924,7 +1924,7 @@ order in which they're executed. The only thing you can assume is that, by the
|
||||
time your custom data files are executed, all the database tables already will
|
||||
have been created.
|
||||
|
||||
.. _`manage.py documentation`: http://www.djangoproject.com/documentation/django_admin/#sqlinitialdata-appname-appname
|
||||
.. _`manage.py documentation`: ../django_admin/#sqlcustom-appname-appname
|
||||
|
||||
Database-backend-specific SQL data
|
||||
----------------------------------
|
||||
|
||||
@@ -1293,3 +1293,11 @@ A collection of template filters that implement these common markup languages:
|
||||
* Textile
|
||||
* Markdown
|
||||
* ReST (ReStructured Text)
|
||||
|
||||
django.contrib.webdesign
|
||||
------------------------
|
||||
|
||||
A collection of template tags that can be useful while designing a website,
|
||||
such as a generator of Lorem Ipsum text. See the `webdesign documentation`_.
|
||||
|
||||
.. _webdesign documentation: ../webdesign/
|
||||
|
||||
@@ -382,7 +382,7 @@ If you're interested, also run the following commands:
|
||||
statements for this app.
|
||||
|
||||
* ``python manage.py sqlall polls`` -- A combination of all the SQL from
|
||||
the 'sql', 'sqlinitialdata', and 'sqlindexes' commands.
|
||||
the 'sql', 'sqlcustom', and 'sqlindexes' commands.
|
||||
|
||||
Looking at the output of those commands can help you understand what's actually
|
||||
happening under the hood.
|
||||
|
||||
Reference in New Issue
Block a user