Hi,
Let's say that in a controller file there are three variables (a, b
and c) each of them contains a string. In a model file there is a
table called 'Table' that has three fields (a_id, b_id and c_id).
My question is how to:
1. Check in the database if there already is a 'Table'-object with an
a_id that is equal to the a-string.
2. If statement 1 is false, then create a new 'Table'-object and put
the a-string into a_id, the b-string into b_id and the c-string into
c_id.
I guess I should do something like this in the controller file:
db = DAL(something) #is it necessary to define the db in the
controller file as well?
a="stringA"
b="stringB"
c="stringC"
db.Table[0]=dict(name=a)
db.Table[1]=dict(name=b)
db.Table[2]=dict(name=c)
This is perhaps a basic-level question, but I'm just a n00b.
Thanks in advance for help!