How to get django settings in JQuery on the admin panel?

29 Views Asked by At

I work with django 3.2 and i use the admin site.

on an admin page, I want to use a variable present in django.settings

My js files are called correctly and jquery works.

How i can get the django settings ?

This is the admin file

class MyAppAdmin(admin.ModelAdmin):
    class Media:
        js = (
            "admin/js/jquery.init.js",
            "my_app/js/admin_my_app.js",
        )

And this is the js file

(function($) {
  $(document).ready(function() {
  // my functions
  ...
  // need to use a django.settings variable here
  // 
})(django.jQuery);

0

There are 0 best solutions below