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:
- security
- to hassle (or know package?)
- 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.
- conditional statement mapped database. i'd stay in django orm
- 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.
- maximize possible complexity: type , number of conditional statements should resemble possible complexity of written conditional statements.
- 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:
- database model (django orm)
- generic view, template , form handling
if have no problem @ - , solution - please share it!
i working on solution , post it.
Comments
Post a Comment