Fix author->songs relation

Fixes: https://launchpad.net/bugs/1369139
This commit is contained in:
Samuel Mehrbrodt 2014-09-14 00:00:28 +02:00
parent 98d5ed7acf
commit 3426fc37d2

View File

@ -31,8 +31,6 @@ The :mod:`db` module provides the database and schema that is the backend for
the Songs plugin
"""
import re
from sqlalchemy import Column, ForeignKey, Table, types
from sqlalchemy.orm import mapper, relation, reconstructor
from sqlalchemy.sql.expression import func, text
@ -329,7 +327,9 @@ def init_schema(url):
Column('topic_id', types.Integer(), ForeignKey('topics.id'), primary_key=True)
)
mapper(Author, authors_table)
mapper(Author, authors_table, properties={
'songs': relation(Song, secondary=authors_songs_table, viewonly=True)
})
mapper(AuthorSong, authors_songs_table, properties={
'author': relation(Author)
})