I don't know if my terminology is correct etc. But the basic idea is
the following.

In my model I have something like

from mylib.helpers import slugify

class MyModel(Base):
    __tablename__ = "testing"

   id = Column(Integer, primary_key)
   title = Column(Unicode)
   description = Column(Unicode)


   @property
   def slug(self):
        return slugify(self.title)



Now I want to be able to do something like.
session.query(MyModel.id, MyModel.title, MyModel.slug).all()

The table obviously doesn't have a slug column, I just want to return
my title as a "pseudo-column" named slug, with it passed through my
slugify method first.

I tried to do something like the following:

@synonym_for("title")
@property
def slug(self):
    return slugify(self.title)

And this did not work.  It seems to just return another column just
like title (not sent through slugify first).  Any idea how I can do
what I am looking for?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to