I have a custom admin form validation js code in separate js file.
i want to render the appropriate js file, meaning if LANGUAGE_CODE
is 'es'
, the js file should end with myjsfile_es.js
I did:
class BlogForm(forms.ModelForm):
class Media:
js = ('js/custom_%s.js' % get_language(),)
the actual page's url is:
http://127.0.0.1:8000/es/admin/blog/blog/add/
but get_language
is giving 'en'
so I end up having wrong js file custom_en.js
for es
page,
en
is default language in settings.py.
how can I get the active language in admin.py?