Git Product home page Git Product logo

django-databrowse's Introduction

Django Databrowse

travis-cli tests status for django-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.

django-databrowse is available on pypi

http://pypi.python.org/pypi/django-databrowse

So easily install it by pip

$ pip install django-databrowse

Or by easy_install

$ easy_install django-databrowse

Another way is by cloning django-databrowse's git repo

$ git clone git://github.com/Alir3z4/django-databrowse.git

Then install it by running:

$ python setup.py install
  1. Point Django at the default Databrowse templates. There are two ways to do this:

    • Add 'django_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_databrowse/templates directory, and add that directory to your TEMPLATE_DIRS setting.
  2. Register a number of models with the Databrowse site:

    import django_databrowse
    from myapp.models import SomeModel, SomeOtherModel, YetAnotherModel
    
    django_databrowse.site.register(SomeModel)
    django_databrowse.site.register(SomeOtherModel, YetAnotherModel)
    

    Note that you should register the model classes, not instances.

    it is possible to register several models in the same call to django_databrowse.site.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).

  3. Change your URLconf to import the ~django_databrowse module:

    from django_databrowse
    

    ...and add the following line to your URLconf:

    (r'^django_databrowse/(.*)', django_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.

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

Then modify the URLconf so that the django_databrowse.site.root view is decorated with django.contrib.auth.decorators.login_required:

(r'^databrowse/(.*)', login_required(django_databrowse.site.root)),

If you haven't already added support for user logins to your URLconf, as described in the user authentication docs, then you will need to do so now with the following mapping:

(r'^accounts/login/$', 'django.contrib.auth.views.login'),

The final step is to create the login form required by django.contrib.auth.views.login. The user authentication docs provide full details and a sample template that can be used for this purpose.

django-databrowse has been tested Django 1.6 and later. To run the the tests:

$ python run_tests.py

It's also available on travis-ci:

https://travis-ci.org/Alir3z4/django-databrowse/

Currently English is only available language that is being packaged. If you would like to contribute in localization you can find django-databrowse project on Transifex as well: https://www.transifex.com/projects/p/django-databrowse/

Translation Status on Transifex

django-databrowse translation status on transifex

django-databrowse's People

Contributors

alir3z4 avatar jstbriggs avatar isthisthat avatar tcsorrel avatar nikolas avatar sdreher avatar justinasjaronis avatar

Watchers

James Cloos avatar Martín Gaitán avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.