title: Using Django constants in Javascript
body: <p>I'm trying to update a field in the database by calling a url pattern from urls.py. The pattern is defined as follows (code slightly changed for security): </p>
  
  <p><code>(r'^pref/(?P&lt;key&gt;\d+)/(?P&lt;value&gt;\d+)/$', 'client.views.update_pref'),</code></p>
  
  <p>key: ENABLE_T (int value 7 as defined in constants.py)</p>
  
  <p>value: 0 (boolean int for False) </p>
  
  <p>In Javascript, I've attempted to call /pref/ENABLE_T/0 under this block of code, but it doesn't go into the <code>$.ajax()</code> function at all.</p>
  
  <pre><code>$.ajax('/pref/7/0/', {
      dataType: 'json',
      success: function(data) {
          alert("Success");
      },
      error: function() {
          // TODO: handle error
          alert("Preferences Error");
      }
  });
  </code></pre>
  
  <p>I'd rather use ENABLE_T instead of the 7 to call that constant. Any suggestions? Thanks!</p>