Closed lmaloney closed 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:
Register your widget in urls.py like:
from dashing.utils import router
router.register(CustomWidget, 'custom_widget')
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.
Yes! This helps big time. I just noticed the config_file setting :)
Thank you, I'm off to implement, will keep you posted.
Back! :)
Great example you provided, I have it working now! :) Wish I could upload a screen shot! :)
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
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."
LinkedIn: http://www.linkedin.com/in/larrymaloney Cell: 408-893-0294
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):
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?