Closed lehnertz85 closed 7 years ago
Alright, after some testing, my routers are working fine if I change my urls.ps to:
from dashing.utils import router
from widgets import NewClientsWidget, AccountWidget
from views import CanvasData
from. import views
router.register(NewClientsWidget, 'custom_widget')
router.register(AccountWidget, 'account_widget')
urlpatterns = [
#url(r'dashboard', CanvasData.as_view()),
#url(r'', views.canvas_dashboard)
url(r'canvas_dashboard/', include(router.urls)),
]
I can go to localhost:8000/canvas_dashboard/widgets/custom_widget
and see the JSON data with my custom data. But, when I navigate to localhost:8000/canvas_dashboard
I see the default dashboard and no custom widgets.
If I do a hard shift
+refresh
my custom js file isn't being loaded, but all the dashing js files are. Including the default dashing-config.js
, which is why the sample dashboard is showing and not my custom one.
How do I prevent the sample dashboard from showing? I do have my custom app above dashing in settings.py
, which is what the instructions say to do in order to override the supplied dashing-config.js file.
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'canvas_data',
'dashing',
]
It would appear that isn't working...
EDIT: Some more food for thought: I don't think my template HTML file is being called/summoned. I have it listed in views.py, but views aren't being used in urls.py like you would normally do. The only reason I have a view.py file is because I tried following the multi-dashboard example to see if I could get that to work.
WARINING: I'm fairly new to Django, but I have created a couple other projects. I'm a complete newb when it comes to js.
I can not, for the life of me, get my data to a widget. I've created a widgets.py file. Performed the operations to get the data. I can do print statements and see the correct values. It took me a while to wrap my head around what django-dashing is doing. I think I have it figured out, but I still can't get my custom data to show up on a widget. In fact, the two widgets I've created are blank.
I decided to do some testing and I can't get any data to show on the widgets I've created.
~ view.py
~ dashing-config.js
In
urls.py
, I can uncomment#url(r'', include(router.urls)),
but my dashboard won't show up, only the default will show.~ urls.py
~ widgets.py
~ my HMTL template
I did some test, so there is some commented out code. Any help would be appreciated.
It looks like the routers are just an API which pushes JSON like syntax.
After all this, my guess is it has something to do with the routers. They're not being called? But, if I try to use the routers, I only get the default dashboard. Perhaps the documentation should have a workflow document, so users can understand how data is transferred throughout. Maybe that's naivety.