django - How to implement database driven if-else statements? -


my programming task right implement if-elif-else constructs in database, users can compose conditional statements.

in conditional block user selects conditional operators, function calls, setting parameters , checking against return value - composing sequence of condition tests.

in execution block user should able select function calls , set parameters - composing sequence of function calls.

i use text field, write parser , use eval(), not option:

  1. security
  2. to hassle (or know package?)
  3. user should need no programming knowledge.

to clear: task again , sample conditional statement map database:

problem: create "if-elsif-else construct" database driven , clickable , performs well.

  1. conditional statement mapped database. i'd stay in django orm
  2. maximize performance: database should not littered objects, performance reasonable good. if have 100k of different conditional statements not want have more 10 objects each on average. less better.
  3. maximize possible complexity: type , number of conditional statements should resemble possible complexity of written conditional statements.
  4. minimize difficulty: usage of construct should easy grasp. conditional statement should composeable. user needs no programming knowledge has basic (human) logical understanding.
 if something(p1, p2, px, ret) , 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) , 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) 

subtasks:

  1. database model (django orm)
  2. generic view, template , form handling

if have no problem @ - , solution - please share it!

i working on solution , post it.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -