Skip to content
Advertisement

Tag: django

Django: Could not parse the remainder

I’m trying to pass a response from JsonResponse as a parameter of specific function in views. But, got the following error instead Here it is my code url.py views.py file.html Answer Your success function is javascript that is running in the front-end. Django is not running your front-end and there is no processing of django templates going on here, so

Showing Image in django

I have a Django web app where I am uploading an image and showing some texts. But I am not able to show the image in the front end after uploading. views.py index.html How can I show the uploaded image here, I have little experience with javascript so If anyone can help me on this! what I tried so far

Django HTML & CSS render to pdf

I’m trying to convert HTML & CSS into a pdf page using Django-weasyprint but I’m kind of stuck with their tutorial because I want the PDF to render the current page when the user clicks on the download button and the pdf downloads automatically with read-only privileges. This whole process kind of feels painful to do. Currently, weasyprint just converts

Django/Webpack – How to serve generated webpack bundles with webpack dev server

Django’s ‘static’ tag generates urls using STATIC_URL, which results in something like ‘/static/myapp/js/bundle.js’ Mean while, webpack-dev-server is serving bundles from the url ‘localhost:3000’ My question is how do I get Django ‘static’ template tag to generate a different url ( which points to webpack dev server) for js bundles. Of course I can hardcode it in the template, but that

TypeError: data.forEach is not a function

This is my code: I get the error that for each does not work on the data variable. However, when I log data to the console, I get [{“model”: “app.mdl”, “pk”: 1, “fields”: {“name”: “test”, “rank”: 1}}] This is clearly an array and iterable, so I don’t get what exactly is wrong. EDIT: data is returned via JsonResponse in Django.

Using Template Specific JavaScript in Django

I have a base_generic.html page in django that has the standard UI elements (navbar, footer, etc.), and I have a list.html page which extends the base_generic.html page. The list.html page is using a javascript function that is only used in this page, but for it to work, I have to include it in the base_generic.html page. How can I include

Advertisement