Hello.

I have Category model:

class Category(Base):
    __tablename__ = 'categories'

    id = Column(Integer, primary_key=True)
    parent_id = Column(Integer, ForeignKey('categories.id'))
    name = Column(Unicode(255), nullable=False)
    description = Column(UnicodeText)
    position = Column(Integer)

    children = relationship('Category', backref=backref('parent', 
remote_side=[id]), lazy='joined', join_depth=1, 
order_by='Category.position')

But I can't access it's 'parent' backref (I want to use it in order_by). 
Why?

>>> from whs.models import Category
>>> Category.parent
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: type object 'Category' has no attribute 'parent'

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


Reply via email to