Deprecated since version 1.4: This module has been deprecated.
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.
How to use Databrowse¶
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.
Register a number of models with the Databrowse site:
from django.contrib import databrowse from myapp.models import SomeModel, SomeOtherModel, YetAnotherModel databrowse.site.register(SomeModel) databrowse.site.register(SomeOtherModel, YetAnotherModel)
Note that you should register the model classes, not instances.Changed in Django 1.4: Please see the release notes
Since Django 1.4, it is possible to register several models in the same call to register().
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).
Change your URLconf to import the databrowse module:
from django.contrib import databrowse
...and add the following line to your URLconf:
The prefix doesn’t matter – you can use databrowse/ or db/ or whatever you’d like.
Run the Django server and visit /databrowse/ in your browser.
Requiring user login¶
You can restrict access to logged-in users with only a few extra lines of code. Simply add the following import to your URLconf:
from django.contrib.auth.decorators import login_required
Having trouble? We'd like to help!
- Try the FAQ — it's got answers to many common questions.
- Search for information in the archives of the django-users mailing list, or post a question.
- Ask a question in the #django IRC channel, or search the IRC logs to see if it has been asked before.
- If you notice errors with this documentation, please open a ticket and let us know! Please only use the ticket tracker for criticisms and improvements on the docs. For tech support, use the resources above.