Hi all,

I'm migrating from django to turbogears so I'm migrating my database
models from django orm to sqlalchemy.

In django was very simple to override save method to do own stuff
before save the value to
database, for example:

class TestModel(models.Model):
    field1=models.CharField(max_length=255)

def save():
    self.field1=self.field1.upper()
    super(TestModel,self).save()

so when I add or modify an object it is ever converted to uppercase.
In sa this simple model become something like:

class TestModel(DeclarativeBase)
    __tablename__='testtable'
    field1=Column(Unicode(255))

def __init__(field1):
    self.field1=field1.upper()

this way if I call the init method field1 is converted to upper but if
i modify the field I have to manually convert to upper. There is some
way in sqlalchemy or turbogears to override save method as in django
orm whtout manually change the value?

regards
drakkan
--~--~---------~--~----~------------~-------~--~----~
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