Skip to content

Tag: django

Django: create endpoint for a file

I have a mesh.obj file and I would like to create an endpoint for it. For example, the endpoint could be of the form ‘path/to/mesh’. How would I do this? Answer In your urls.py: In your views.py:

Django Exception KeyError ‘data’ – Only runs once

I am trying to make a web app using Django that accepts 2 inputs from the user: Mathematical Operator: 1 for addition, 2 for multiplication, etc. Number of Pages Based on this, a math worksheet is generated and downloaded. All of this works out fine, but only once. When I try to regenerate a second PDF, I get…

Django filter on combination using F

I wrote the following query using the Django ORM: With this I’m trying to filter out each fixture where the prediction__value for the home is greater than 0.0 and the prediction__value of the away is greater than 0.0. Sadly my query is returning 0 records upon using .count() whereas it should return alm…

Django urls.py issue, not sure what to put in ‘urlpatterns’

I’ve been following this tutorial (Django Tutorial Part 3) and I’ve stumbled across what I’m assuming is a syntax issue between the time this tutorial was written and the new Django releases. My admin page loads just fine. Code Block in Question So in the picture linked, that is the area tha…