title: Django - allow user to run custom python code
body: <p>Simple question that I can't seem to find an answer to:
  Is there a way in django to allow user to write their own custom code inside a textbox and to execute the code later on or on button-click?
  With this i mean the same it is implemented in w3scools: <a href="https://www.w3schools.com/python/trypython.asp?filename=demo_default" rel="nofollow noreferrer">https://www.w3schools.com/python/trypython.asp?filename=demo_default</a></p>
  
  <p>I don't need to be able to visualize the result in a second screen or anything. The goal is to  allow the user to write some basic but custom functionality!</p>
  
  <p>Imagine having access to a dictionary, and the user wants to transform the value of one of the keys: <br>
  e.g. <br></p>
  
  <pre><code>_dict = {'key1': 'xxx yyy', 'key2': 'yyy zzz'}
  </code></pre>
  
  <p>and the user can create a custom key3 which is a concatenation of the two other keys.</p>
  
  <pre><code>_dict['key3'] = _dict['key!'] + _dict['key2'] 
  </code></pre>
  
  <p>So here I have to expose the variable containing the dictionary and allow the user to write a custom python code to do whatever they want with it. <strong>OR</strong> embed the custom code into the actual code on run-time.</p>
  
  <p>Security for now is not a concern (but interesting to know how this could be handled).</p>