Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Horizon Django tools.

Project Description

horizon-django contrib

Library built on top of Django and Horizon(part of OpenStack Dashboard) for building modern web applications.

With this toolkit is building applications blazingly fast and easy !

This library provide generic implementation most of Horizon components, add more tools for easily scaffolding applications and preserves support for complex customizations.

Short story

Horizon is pretty package for fast creating UI for everything. But is designed for model-less applications like an OpenStack Dashboard. If we connect Horizon with typical Django application we must create same pieces of same components and this is really suck ! We want more declarative and less imperative code. For this purpose we create this library which compose common stuff in one place.

Features

  • With Django and Conent Types

    • Views - PaginatedIndex, Create, Update, Delete in Angular modal’s
    • Tables with inline-ajax update
    • Modal Forms autohandled
    • Generic - IndexView with pagination, CRUD actions and AJAX inline-edit.

no implementation required, all Django stuff is generated automatically like an admin, but in more customizeable and extendable form.

  • Rest API Dashboards

    • APIModel
    • Manager
    • ClientBase - simple implementation which uses requests
    • Generic - Tables, Views, Actions

and plus all features defined under Django because if we have model most of things works well without any modification.

Manager has all responsibilty for get data from remote API. It`s simple object which has similar methods with django model managers. And it’s bound to Abstract model.

See [Documentation] ! Examle App

Requires

  • Django
  • Horizon - part of OpenStack Dashboard

Tested with

  • Horizon 2012+ (Icehouse +)
  • Django 1.4 +
  • Python 2.6 +

Installation

pip install testrepository
pip install horizon-contrib

pip install git+https://github.com/michaelkuty/horizon-contrib.git#egg=horizon-contrib

Now as you wish install horizon, if you don’t know about this, use this command:

pip install horizon-contrib[horizon]

Configuration

INSTALLED_APPS += ('horizon_contrib',)

Next configuration depends on your scenario

For usually Django application we must include horizon_contrib.urls or include horizon.urls. If we include horizon’s urls Contrib urls will be mapped as Horizon dashboard.

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    ...
    url(r'^contrib/', include('horizon_contrib.urls'), ),
    ...
    # or
    url(r'^horizon/', include('horizon.urls'), ),
)

Django example

With Django model everythings works well without any code. Only navigate your browser to

  • /contrib/models/project/index
  • /contrib/models/project/create
  • /contrib/models/project/1/update

For override behaviour see doc.

Horizon example REST-API !

Dashboard structure:

my_dashboard
    |-- __init__.py
    |-- projects
        |-- __init__.py
        |-- models.py   # define data structure
        |-- managers.py # load remote data
        |-- panel.py    # register namespace
    |-- dashboard.py

Your models.py

from horizon_contrib.api import APIModel
from horizon_contrib.common import register_model

class Project(APIModel):

    name = models.CharField('id', primary_key=True)  # default primary is id
    description = models.CharField..
    ...

    objects = Manager()  # see below

    class Meta:
        verbose_name = 'Project'
        abstract = True

register_model(Project)  # supply Django Content Type framework

New managers.py

from horizon_contrib.api import Manager

class Manager(Manager):

    def all(self, *args, **kwargs):
        return self.request('/projects')

Finally panel.py

from horizon_contrib.panel import ModelPanel
from horizon_redmine.dashboard import RedmineDashboard

class ProjectPanel(ModelPanel):
    name = "Projects"
    slug = 'projects'
    model_class = 'project'

RedmineDashboard.register(ProjectPanel)

navigate your browser to

  • /contrib/models/project/index
  • /contrib/models/project/create
  • /contrib/models/project/1/update

For React SortTable

pip install xstatic-react

Add to settings.py

import xstatic.pkg.react

STATICFILES_DIRS = [
    ('lib', xstatic.main.XStatic(xstatic.pkg.react).base_dir),

]
  • /contrib/models/project/react ..
from horizon_contrib.tables import ReactTable

For more code see [Documentation].

Release History

Release History

This version
History Node

2016.9.5

History Node

2016.9.4

History Node

2016.9.3

History Node

2016.9.2

History Node

2016.9.1

History Node

2016.9.0

History Node

2016.8.2

History Node

2016.8.1

History Node

2016.8.0

History Node

2016.7.5

History Node

2016.7.4

History Node

2016.7.3

History Node

2016.7.2

History Node

2016.7.1

History Node

2016.7.0

History Node

2016.6.0

History Node

2016.5.2

History Node

2016.5.1

History Node

2016.4.0

History Node

2016.3.2

History Node

2016.3.0

History Node

2016.2.0

History Node

2015.11.7

History Node

2015.11.6

History Node

2015.11.5

History Node

2015.11.4

History Node

2015.11.3

History Node

2015.11.2

History Node

2015.11.1

History Node

2015.11.0

History Node

2015.10.5

History Node

2015.10.4

History Node

2015.10.3

History Node

2015.10.1

History Node

2015.10.0

History Node

2015.9.0

History Node

2015.8.0

History Node

2015.7.6

History Node

2015.7.5

History Node

2015.7.4

History Node

2015.7.2

History Node

2015.7.1

History Node

2015.7.0

History Node

2015.6.1

History Node

2015.0.7

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
horizon_contrib-2016.9.5.tar.gz (62.2 kB) Copy SHA256 Checksum SHA256 Source Sep 23, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting