title: How to implement database driven if-else statements?
body: <p>My programming task right now is to implement if-elif-else constructs in a database, so that users can easily compose their conditional statements. </p>
  
  <p>In the conditional block the user selects conditional operators, function calls, setting parameters and checking against the return value - composing a sequence of condition tests.</p>
  
  <p>In the execution block the user should be able to select function calls and set parameters - composing a sequence of function calls.</p>
  
  <p>I could use a text field, write a parser and use eval(), but this is not an option:</p>
  
  <ol>
  <li>Security</li>
  <li>To much hassle (or do you know a good package?)</li>
  <li>User should need no programming knowledge.</li>
  </ol>
  
  <p>To be clear: The task again and a sample conditional statement I would like to map to the database:</p>
  
  <p>Problem: Create an "if-elsif-else construct" that is database driven and easily clickable and performs well.</p>
  
  <ol>
  <li>Conditional Statement mapped into the database. I'd like to stay in the Django ORM</li>
  <li>Maximize Performance: The database should not be littered with objects, so that performance is reasonable good. If I have 100k of different conditional statements I do not want to have more than 10 objects each on average. The less the better.</li>
  <li>Maximize Possible Complexity: type and number of conditional statements should resemble the possible complexity of written conditional statements.</li>
  <li>Minimize Difficulty: The usage of the construct should be easy to grasp. The conditional statement should be easily composeable. User needs no programming knowledge but has basic (human) logical understanding.</li>
  </ol>
  
  <pre><code>
  if something(p1, p2, px, ret) and someotherthing(p1, p2, px, ret):
      dothis(p1, p2, px)
      thendothat(p1, p2, px)
  elif somethought(p1, p2, px, ret) or someotherthougt(p1, p2, px, ret) and acrazythought(p1, p2, px, ret):
      thinkthis(p1, p2, px)
      thenthinkthat(p1, p2, px)
      finallyconclude(p1, p2, px)
  else:
      sayinaudiblethings(p1, p2, px)
      donothing(p1, p2, px)
  </code></pre>
  
  <p>SubTasks:</p>
  
  <ol>
  <li>Database Model (Django ORM)</li>
  <li>Generic View, Template and Form handling</li>
  </ol>
  
  <p>If you have no problem at all - and a good solution - please share it!</p>
  
  <p>I am currently working on a solution and eventually would post it.</p>