## 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
some-javascript.js,
<!-- language: lang-javascript -->
django.jQuery.get('{% url "validate_username" %}')
## expect behavior
If I could create my url with django I could send the request without problems, Thanks in advance
I posted this question on: https://stackoverflow.com/posts/44266904/edit
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/99b1a2e3-879e-4395-98b4-52ba8d286bbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment