talpor / django-dashing

django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing
BSD 3-Clause "New" or "Revised" License
731 stars 108 forks source link

Install & Usage #26

Closed lmaloney closed 9 years ago

lmaloney commented 9 years ago

Thanks for making this awesome project, but I'm having an issue installing and usage....

I've followed the documentation, and I can pull up the built in "demo" dashboard in my project, however the docs don't really explain how to setup an HTML file/view for my own custom dashboard.

I could modify the default dashboard, but that's not what should be done.

I went ahead and created an HTML file, and served it through a view like this:

from django.http import HttpResponse, StreamingHttpResponse from django.shortcuts import render, render_to_response, redirect, RequestContext

view.py: def test_dashboard(request):

context={ }
return render(request,'dashing/dashing.html',context)      

html file: {% extends 'dashing/base.html' %} {% load staticfiles %}

{% block 'stylesheets' %}

{% endblock %}

When I render this, I still get the default dashboard data, even if my dashing-config.js file is empty.

So, my questions are two fold:

1.) How do I setup my own dashboard (not use the built in dashboard) (I've read the example trelio card app, and still can't figure it out)

2.) Once I am rendering my HTML document, how to I point the JS/HTML to retreive data from the widget classes setup?

mtdb commented 9 years ago

If you want make your own view you can do some like this https://github.com/talpor/django-dashing/blob/master/test/test_app/test_app/views.py

But if you only need make your own dashboard and retrive data from django you can do some like:

  1. Create a django dashboard application with a widgets.py and urls.py file
  2. Create your widget extended from NumberWidget, ListWidget, GraphWidget or simply Widget (from dashing.widgets)
  3. Register your widget in urls.py like:

    from dashing.utils import router
    router.register(CustomWidget, 'custom_widget')
  4. Create a dashing-config.js file with a widget that retrive the data like:

    var myDashboard = new Dashboard();
    myDashboard.addWidget('customWidget', 'Number', {
       getData: function () {
           var self = this;
           $.get('/dashboard/widgets/custom_widget/', function(data) {
               $.extend(self.data, data);
           });
       },
       interval: 3000
    });

Also if you want locate the config file in a diferent directory you can create an dashing/dashboard.html file in your TEMPLATE_DIRS and replace the config_file block for your config route, look https://github.com/talpor/django-dashing/blob/master/test/test_app/templates/multiple_dashboards.html

Let me know if I can help you with anything else.

lmaloney commented 9 years ago

Yes! This helps big time. I just noticed the config_file setting :)

Thank you, I'm off to implement, will keep you posted.

lmaloney commented 9 years ago

Back! :)

Great example you provided, I have it working now! :) Wish I could upload a screen shot! :)

mtdb commented 9 years ago

I added a quick start section in the readme file, then I will proceed to close this issue, thanks for letting me notice about this missing information in the readme file

lmaloney commented 9 years ago

Awesome! Great work. :)

On Monday, April 27, 2015, Mauricio notifications@github.com wrote:

I added a quick start section in the readme file, then I will proceed to close this issue, thanks for letting me notice about this missing information in the readme file

— Reply to this email directly or view it on GitHub https://github.com/talpor/django-dashing/issues/26#issuecomment-96783269 .

Thank you!

Larry P. Maloney, "Come to the Dojo."

Become a member: http://signup.hackerdojo.com/

LinkedIn: http://www.linkedin.com/in/larrymaloney Cell: 408-893-0294