Django

Code

root/django/branches/per-object-permissions/docs/databrowse.txt

Revision 5488, 2.1 kB (checked in by clong, 1 year ago)

per-object-permissions: Merged to trunk [5486] NOTE: Not fully tested, will be working on this over the next few weeks.

Line 
1 ==========
2 Databrowse
3 ==========
4
5 Databrowse is a Django application that lets you browse your data.
6
7 As the Django admin dynamically creates an admin interface by introspecting
8 your models, Databrowse dynamically creates a rich, browsable Web site by
9 introspecting your models.
10
11 .. admonition:: Note
12
13     Databrowse is **very** new and is currently under active development. It
14     may change substantially before the next Django release.
15
16     With that said, it's easy to use, and it doesn't require writing any
17     code. So you can play around with it today, with very little investment in
18     time or coding.
19
20 How to use Databrowse
21 =====================
22
23     1. Point Django at the default Databrowse templates. There are two ways to
24        do this:
25
26        * Add ``'django.contrib.databrowse'`` to your ``INSTALLED_APPS``
27          setting. This will work if your ``TEMPLATE_LOADERS`` setting includes
28          the ``app_directories`` template loader (which is the case by
29          default). See the `template loader docs`_ for more.
30
31        * Otherwise, determine the full filesystem path to the
32          ``django/contrib/databrowse/templates`` directory, and add that
33          directory to your ``TEMPLATE_DIRS`` setting.
34
35     2. Register a number of models with the Databrowse site::
36
37            from django.contrib import databrowse
38
39            databrowse.site.register(SomeModel)
40            databrowse.site.register(SomeOtherModel)
41
42        Note that you should register the model *classes*, not instances.
43
44        It doesn't matter where you put this, as long as it gets executed at
45        some point. A good place for it is in your URLconf file (``urls.py``).
46
47     3. Change your URLconf to import the ``databrowse`` module::
48
49            from django.contrib import databrowse
50
51        ...and add the following line to your URLconf::
52
53            (r'^databrowse/(.*)', databrowse.site.root),
54
55        The prefix doesn't matter -- you can use ``databrowse/`` or ``db/`` or
56        whatever you'd like.
57
58     4. Run the Django server and visit ``/databrowse/`` in your browser.
59
60 .. _template loader docs: ../templates_python/#loader-types
Note: See TracBrowser for help on using the browser.