the first one works for insertion. let us know how you do updates.

On 18 Temmuz, 22:16, Timuçin Kızılay <[email protected]> wrote:
> Mengu yazmış:
>
>
>
>
>
> > doesn't this help?:
>
> > def __init__(self, a, b, c):
> >   self.a = a
> >   self.b = b
> >   self.c = a + b
>
> > On 18 Temmuz, 18:00, Timuçin Kızılay <[email protected]> wrote:
> >> I've read the documentation but could not find it so I'm asking here.
>
> >> I have a table in models and there is a column in that model that it's
> >> value shuld be changed when there is an insert or update on that table.
>
> >> here is an example:
> >> -----------
> >> class Sometable(DeclarativeBase):
> >>     __tablename__ = 'sometable'
> >>     id = Column(Integer, autoincrement=True, primary_key=True)
> >>     a = Column(Unicode(50))
> >>     b = Column(Unicode(50))
> >>     c = Column(Unicode(100))
> >> -------
>
> >> in that table, I want only set the values of a and b and value of c
> >> should be c = a + b
> >> I think I should write a function but where should I put that function?
>
> it helps only when creating a new record but not updating or setting the
> fields like this.
>
> -------------------------------
> somerecord = model.SomeTable()
> somerecord.a = 'something'
> somerecord.b = 'otherthing'
>
> model.DBSession.add(somerecord)
> -------------------------------
>
> I need to write some function that should run when a record updated or
> inserted to set other fields depending of some fields.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to