tool v0.5.0 documentation

Web Admin

«  Storm ORM   ::   Contents   ::   Data Analysis  »

Web Admin

state:beta
dependencies:Doqu

Administrative interface for Doqu. Requires tool.ext.documents to be properly set up.

Complete configuration example (see Application for details):

extensions:
    tool.ext.admin.AdminWeb: null
    tool.ext.werkzeug_routing.Routing:
        tool.ext.admin.views: /admin/
class tool.ext.admin.DocAdmin
Description of admin interface for given Document class.
tool.ext.admin.register(model, namespace='main', url=None, exclude=None, ordering=None, list_names=None, search_names=None)
Parameters:
  • model – a Doqu document class
  • namespace – a short string that will be part of the URL. Default is “main”.
  • url – a function that gets a model instance and returns an URL
  • ordering – a dictionary in this form: {'names': ['foo'], 'reverse': False}. See Doqu query API for details on ordering.
  • list_names – a list of field names to be displayed in the list view.
  • search_names – a list of field names by which to search.

Usage:

from doqu import Document
from tool.ext import admin
from tool import app

class Item(Document):
        ...
admin.register(Item)
tool.ext.admin.register_for(doc_class)

Decorator for DocAdmin classes. Usage:

@admin.register_for(Note)
class NoteAdmin(admin.DocAdmin):
    namespace = 'notepad'
    url = lambda d: d.get_url()
    exclude = ['foo']
    ordering = {'names': ['date_time'], 'reverse': True}

«  Storm ORM   ::   Contents   ::   Data Analysis  »