1👍
After some more digging around I’ve found the answer to why doesn’t this work in another question at:
The answer to it by Ludwik Trammer says:
Django templates are build on the server side, while JavaScript is executed on the client side.
That means that template code is always executed before JavaScript (as
it is executed by the server, before the page is sent to the client).
As a consequence it is absolutely impossible to mix JavaScript and
Django code the way you want to.
Which clearly applies here. I was focused on problems with the URL template, regex on the urls.py file etc. when the problem was that no matter what I did, because it’s in a javascript section, run client-side, that URL template will always be incomplete no matter what I do, therefore being an impossible solution to what I want.
1👍
According to the error message, feature.properties.myslug
is empty or has no value.
Make sure the feature.properties.myslug
is passed correctly from view.
- Comment out
{% url .. %}
temporarily. - Print
{{ feature }}
,{{ feature.properties }}
,{{ feature.properties.myslug }}
to see if which part is missing. - Fix view accordingly.
- Uncomment
{% url .. %}
.
- [Answered ]-The proper way to go from staging to production?
- [Answered ]-Create a APP named admin in my project whether will get unknown conflict?
- [Answered ]-Django REST – create object with PrimaryKey
- [Answered ]-Invisible table borders ReportLab