diff --git a/cps/ub.py b/cps/ub.py index fe1ba719..0f1c5b5a 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -153,7 +153,7 @@ class User(UserBase, Base): role = Column(SmallInteger, default=ROLE_USER) password = Column(String) kindle_mail = Column(String(120), default="") - shelf = relationship('Shelf', backref='user', lazy='dynamic') + shelf = relationship('Shelf', backref='user', lazy='dynamic', order_by='Shelf.name') downloads = relationship('Downloads', backref='user', lazy='dynamic') locale = Column(String(2), default="en") sidebar_view = Column(Integer, default=1) diff --git a/cps/web.py b/cps/web.py index 9935d7d4..b9f7a500 100755 --- a/cps/web.py +++ b/cps/web.py @@ -623,7 +623,7 @@ def before_request(): g.user = current_user g.allow_registration = config.config_public_reg g.allow_upload = config.config_uploading - g.public_shelfes = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1).all() + g.public_shelfes = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1).order_by(ub.Shelf.name).all() if not config.db_configured and request.endpoint not in ('basic_configuration', 'login') and '/static/' not in request.path: return redirect(url_for('basic_configuration')) @@ -1250,7 +1250,7 @@ def language(name, page): @login_required_if_no_ano def category_list(): entries = db.session.query(db.Tags, func.count('books_tags_link.book').label('count'))\ - .join(db.books_tags_link).join(db.Books).filter(common_filters())\ + .join(db.books_tags_link).join(db.Books).order_by(db.Tags.name).filter(common_filters())\ .group_by('books_tags_link.tag').all() return render_title_template('list.html', entries=entries, folder='category', title=_(u"Category list"))