Package: horizon_contrib
horizon-django contribShort storyFeaturesRequiresTested withInstallationConfigurationDjango exampleHorizon example REST-API !Read moreLibrary 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 storyHorizon 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.FeaturesWith Django and Conent TypesViews - PaginatedIndex, Create, Update, Delete in Angular modal’sTables with inline-ajax updateModal Forms autohandledGeneric - 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 DashboardsAPIModelManagerClientBase - simple implementation which usesrequestsGeneric - Tables, Views, Actionsand 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.OthersReactJS integration - for large tables with thousands rows we have integratedhttps://github.com/glittershark/reactableasReactTableLinkedListColumnset of common filters, templatetagsSee[Documentation]!Examle AppRequiresDjangoHorizon - part of OpenStack DashboardTested withHorizon 2012+ (Icehouse +)Django 1.4 +Python 2.6 +Installationpipinstalltestrepositorypipinstallhorizon-contribpipinstallgit+https://github.com/michaelkuty/horizon-contrib.git#egg=horizon-contribNow as you wish install horizon, if you don’t know about this, use this command:pip install horizon-contrib[horizon]ConfigurationINSTALLED_APPS+=('horizon_contrib',)Next configuration depends on your scenarioFor usually Django application we must includehorizon_contrib.urlsor includehorizon.urls. If we include horizon’s urls Contrib urls will be mapped as Horizon dashboard.fromdjango.conf.urlsimportpatterns,include,urlurlpatterns=patterns('',...url(r'^contrib/',include('horizon_contrib.urls'),),...# orurl(r'^horizon/',include('horizon.urls'),),)Django exampleWith 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/updateFor 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.pyYourmodels.pyfromhorizon_contrib.apiimportAPIModelfromhorizon_contrib.commonimportregister_modelclassProject(APIModel):name=models.CharField('id',primary_key=True)# default primary is iddescription=models.CharField.....objects=Manager()# see belowclassMeta:verbose_name='Project'abstract=Trueregister_model(Project)# supply Django Content Type frameworkNewmanagers.pyfromhorizon_contrib.apiimportManagerclassManager(Manager):defall(self,*args,**kwargs):returnself.request('/projects')Finallypanel.pyfromhorizon_contrib.panelimportModelPanelfromhorizon_redmine.dashboardimportRedmineDashboardclassProjectPanel(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/updateFor React SortTablepipinstallxstatic-reactAdd tosettings.pyimportxstatic.pkg.reactSTATICFILES_DIRS=[('lib',xstatic.main.XStatic(xstatic.pkg.react).base_dir),]/contrib/models/project/react..fromhorizon_contrib.tablesimportReactTableFor more code see[Documentation].Read morehttp://horizon-contrib.readthedocs.orghttps://www.djangoproject.com/https://github.com/openstack/horizonhttp://docs.openstack.org/developer/horizon/[Documentation](1,2)http://horizon-contrib.readthedocs.org