Search code examples
javascriptdjangoajaxdatatablepermissions

Use Django Permission in Pure Javascript


I used Django Permission in Django Template before like {% if perms.assets.change_log %} and it works.

I want to this to render a server-side datatable in JavaScript but it failed, like

<script>
console.log(perm.assets.change_log)
</script>

There is nothing output on the console.

Could you please help me with this?

Thanks a lot.


Solution

  • <script>
    console.log({{ perm.assets.change_log|safe }})
    </script>
    

    try this