Skip to content

Tag: django

Change Django theme based on logged in, profile, or toggle

I would like to allow the user to have the ability to change the theme based on the following factors: Anonymous Check localStorage and if empty use default else use localStorage Authenticated Check localStorage and if empty use user profile setting I have it all working except for Authenticated users, I don’t know how to check localStorage. Answer Here is

Chart.js- Dates not displaying correctly on chart and axis labels not showing

I’m trying to label my axes on my chart. I’m using chart.js v3.9.1 and I believe I’ve followed the documentation, however the labels aren’t showing up (see below): health_hub_tracker.html: You will also see that on my x axis- the dates are coming through as a sum. The data I have are: [‘2022-10-09’, ‘2022-10-09’, ‘2022-10-05’, ‘2022-10-05’, ‘2022-10-05’] so it is

Using innerHTML to include HTML Django page not work

I am trying to include an HTML when a button is clicked in a Django project but the error a Uncaught SyntaxError: Invalid or unexpected token Here is the Javascript: The error showing is at this line of code as if the include code is not there at all. My question: How can I add this code through javascript and

Change object label on specific value in js

I’m working on charts in React.js and i want to display data sorted by month. In django i’ve created view for displaying json with total events per month and it looks like this: I would like to sort every object in that array and change value ‘month’ from numbers to month name, so it would be: For generating charts i’m