Open BatoolGasser opened 5 months ago
That tag doesnt support the use of initial arguments, as per the documentation
Is there a particular reason you can't use another tag, such as plotly_app
or plotly_app_bootstrap
?
Alternatively, you could create (or update, as appropriate) an instsance of a DashApp in your view and directly render it; this object contains the current state and so can be set to hold whatever values you wish to set.
but in my project I have 5 dash Apps integrated in 5 html templates, each app displays the data of the user that login with email and password, So there exist a lot of details , a lot of Apis used in each part of the app so i think creating or updating each part in each app will be dispersed
and the reason that i do not prefer plotly_app
and 'plotly_app_bootstrap' that the dash app will be injected as iframe
and it makes scroller and effects css styles
the sidebar is html , css and the remaining is dash apps
That tag doesnt support the use of initial arguments, as per the documentation
Is there a particular reason you can't use another tag, such as
plotly_app
orplotly_app_bootstrap
?Alternatively, you could create (or update, as appropriate) an instsance of a DashApp in your view and directly render it; this object contains the current state and so can be set to hold whatever values you wish to set.
Or what do you mean by updating an instance of the dash app direclty in views? i understand that i will get the data from the api like this but i have many apis for each part of the dash app, so i will have many variables and creating all dash apps in views to access it , So how it will be rendered in html template (with sidebar) and the data will change by different users so i need it to be fash
def student_performance_display(request):
cards_data = requests.get("http://127.0.0.1:8000/cards/ab33da02-c725-4f47-85dc-7908374b267c").json()
context = {
'passed_hours': cards_data[0]['passed_hours'],
'cummulative_gpa': cards_data[0]['cummulative_gpa']
}
return render(request, 'student_performance', context)
@BatoolGasser getting that data is probably best separated out (if the URL is constant then it never changes; if it does change then presumably it depends on the current user/session/request; either way it is likely one or other of the cache and ORM are the best places for it).
Once you've got it somewhere, you can then use the information. If its available through the current user session or similar, then an extended callback provides access to the Django request.
how can i get data from django template into dash app that integrated into it
this is the html template:
this is views.py: def student_performance_display(request): cards_data = requests.get("http://127.0.0.1:8000/cards/ab33da02-c725-4f47-85dc-7908374b267c").json() context = { 'passed_hours': cards_data[0]['passed_hours'], 'cummulative_gpa': cards_data[0]['cummulative_gpa'] } return render(request, 'home/student/student_performance.html', context)