5 Databrowse is a Django application that lets you browse your data.
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.
13 Databrowse is **very** new and is currently under active development. It
14 may change substantially before the next Django release.
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
23 1. Point Django at the default Databrowse templates. There are two ways to
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.
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.
35 2. Register a number of models with the Databrowse site::
37 from django.contrib import databrowse
38 from myapp.models import SomeModel, SomeOtherModel
40 databrowse.site.register(SomeModel)
41 databrowse.site.register(SomeOtherModel)
43 Note that you should register the model *classes*, not instances.
45 It doesn't matter where you put this, as long as it gets executed at
46 some point. A good place for it is in your URLconf file (``urls.py``).
48 3. Change your URLconf to import the ``databrowse`` module::
50 from django.contrib import databrowse
52 ...and add the following line to your URLconf::
54 (r'^databrowse/(.*)', databrowse.site.root),
56 The prefix doesn't matter -- you can use ``databrowse/`` or ``db/`` or
59 4. Run the Django server and visit ``/databrowse/`` in your browser.
64 You can restrict access to logged-in users with only a few extra lines of
65 code. Simply add the following import to your URLconf::
67 from django.contrib.auth.decorators import login_required
69 Then modify the URLconf so that the ``databrowse.site.root`` view is decorated
70 with ``login_required``::
72 (r'^databrowse/(.*)', login_required(databrowse.site.root)),
74 If you haven't already added support for user logins to your URLconf, as
75 described in the `user authentication docs`_, then you will need to do so
76 now with the following mapping::
78 (r'^accounts/login/$', 'django.contrib.auth.views.login'),
80 The final step is to create the login form required by
81 ``django.contrib.auth.views.login``. The `user authentication docs`_
82 provide full details and a sample template that can be used for this
85 .. _template loader docs: ../templates_python/#loader-types
86 .. _user authentication docs: ../authentication/