You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
## Context
I am adding a static javascript file to my **ModelForm** on this way
forms.py
<!-- language: lang-python -->
class SomeForm(forms.ModelForm):
class Media:
js = ('some-javascript.js',)
## Problem
On this javascript I need send a GET request to a rest endpoint hosted on same application using jquery, but i need the Server domain or a function to construct my url
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Context
I am adding a static javascript file to my **ModelForm** on this way
forms.py
classSomeForm(forms.ModelForm):
classMedia: js =('some-javascript.js',)
Problem
On this javascript I need send a GET request to a rest endpoint hosted on same application using jquery, but i need the Server domain or a function to construct my url
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Everything looking like {% %} or {{ }} are template tag. Your js file
are not processed by the templating engine so they can be served
really fast directly by your web server and not by django which is a
lot slower.
One solution would be to but the url in your html file. Add a <script>
tag sonewhere with `URL = { validate_username: "{% url
"validate_username" %}" }; `