Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I assume you're seeing these <code>\xc3\xb4</code> strings in your browser.. Have you tried editing your template file to define the proper charset in the HTML header?</p> <pre><code>&lt;head&gt; &lt;meta name="description" content="example" /&gt; &lt;meta name="keywords" content="something" /&gt; &lt;meta name="author" content="Etienne" /&gt; &lt;meta charset="UTF-8" /&gt; &lt;!-- &lt;---- This line --&gt; &lt;/head&gt; </code></pre> <p><strong>Edit after your first comment in this answer:</strong></p> <p>I suspect <code>getattr</code> will not work with other than <code>ascii</code> encoding. Do you think something like the following will not do what you want?</p> <pre><code>from django.conf import settings def getValueFromSetting(request): myConstantValue = settings.MY_CONSTANT_NAME # check myConstantValue here </code></pre> <p><strong>Edit after last comments:</strong></p> <p>I think now I understand your problem. You don't like the fact that the JSON returned by the view is ASCII-only. I recommend you to use <code>dumps</code> function provided by the <code>json</code> module bundled with Python. Here's an example:</p> <pre><code># -*- coding: utf-8 -*- # other required imports here import json def dumpjson(request): response = HttpResponse(json.dumps(settings.CONSTANT_TUPLE, encoding='utf-8', ensure_ascii=False), content_type='application/json') return response </code></pre> <p>The <code>CONSTANT_TUPLE</code> in the example is just a copy of <code>DATABASES</code> in my <code>settings.py</code>. </p> <p>The important bit here is <code>ensure_ascii=False</code>. Could you try it? Is that what you want?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload