This is my JS file to make the checkboxes, i just want that the checked prop of the checkbox updates itself base on the value of the input because my template engine renders the value of the boolean fields directly to my input value attr. But is not working Answer Solved, main problem was {{item.validate|lower}} returned a “true” “false” string
Tag: django
Is it possible to invoke sound from the JS file in Django’s HTML template without Ajax?
I’m in the middle of migrating a site to Django framework. Almost all JS scripts works, except those related to sound. I have a play/pause button for a song and some sounds invoked when the mouse is hovering over particular buttons. For just those files I received from the console: Of course, those files are in /static/hangman_game/ folder. Other static
Django and JS for loop: how to change a variable value into {%static ‘path’ %}?
I’m trying to find out how to change a path in a picture having JS logic in the Django template. As an example – according to logic in the JS script – change from: hangman_game/img/s0.jpg to hangman_game/img/s1.jpg then to hangman_game/img/s2.jpg ect In the previous framework, it was working. But now, I’m migrating a page to the Django framework. Almost all
How do I sort the movies according to their star ratings and filter the movies with lower rating than the specified threshold
I want to sort the movies according to their star ratings and filter the movies with lower rating than the specified threshold. I want to sort movie and TV information in descending order by stars, search by each ID, and display data.json format and socre. However, I get a’module’ object does not support item assignment error. context [“movie”] = in
How do I get all the commented TV and movie scores in descending order? django
What we want to achieve. I want to sort the movies according to their star ratings and filter the movies with lower rating than the specified threshold. 2. get the IDs of Movie and TV that are commented in the View, and get the data and score by url one by one. 3. Return it to the html and display
JSON POST and GET 404 (Not Found)
I am trying to create an API in Django but am receiving the following errors message in the JavaScript console. Does anyone know how to fix this problem? API url: path(“edit/<int:post_id>”, views.edit, name=”edit”) views.py JavaScript HTML I think something might be wrong in the way I am passing in the id to the API, but I am not sure. Could
How to serialize a model with many to maany relashionship?
I have this function in my model, but likes is actualy a many to many relashionship with User. How can I serialize it to get something like this? So that I can also get rid of the ‘likes number’ property. Answer You can use list comprehension to serialize your data, but using django rest framework’s serializer is more proper.
how to get messages (data) in real time from database using ajax and django
i want to get messages in realtime using ajax and django for the backend, i have written the logic to send the messages and that is working, but i want to get a message immediately another user sends me a message without having to refresh the page, i tried using ajax interval but it seem i am not getting a
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
Unhandled Rejection (TypeError): Cannot read properties of null (reading ‘product’)
This error appears to me when I add something to the shopping cart . I’ve checked the code many times, but I still can’t find the solution, I don’t know how to make it work. code in cartActions.js code in cardReducers.js I think the problem comes from here, but I don’t know exactly where to change code in CartScreen.js Here