1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-21 16:30:00 +00:00

Further cleanup

This commit is contained in:
TheAMM 2019-04-08 18:29:48 +03:00 committed by Nicolas F
parent bd4eba9ab7
commit a7558823d0
2 changed files with 7 additions and 6 deletions

View file

@ -186,7 +186,7 @@ class TorrentBase(DeclarativeHelperBase):
@declarative.declared_attr
def trackers(cls):
return db.relationship(cls._flavor_prefix('TorrentTrackers'), uselist=True,
cascade="all, delete-orphan", lazy='select',
cascade="all, delete-orphan",
order_by=cls._flavor_prefix('TorrentTrackers.order'))
@declarative.declared_attr
@ -498,8 +498,7 @@ class User(db.Model):
bans = db.relationship('Ban', uselist=True, foreign_keys='Ban.user_id')
preferences = db.relationship('UserPreferences',
back_populates='user', uselist=False, lazy='select')
preferences = db.relationship('UserPreferences', back_populates='user', uselist=False)
def __init__(self, username, email, password):
self.username = username

View file

@ -24,8 +24,6 @@ def view_torrent(torrent_id):
.options(joinedload('filelist')) \
.filter_by(id=torrent_id) \
.first()
comments = models.Comment.query \
.filter_by(torrent_id=torrent_id)
if not torrent:
flask.abort(404)
@ -69,11 +67,15 @@ def view_torrent(torrent_id):
if torrent.filelist:
files = json.loads(torrent.filelist.filelist_blob.decode('utf-8'))
torrent_comments = models.Comment.query.filter_by(
torrent_id=torrent_id
).order_by(models.Comment.id.asc())
report_form = forms.ReportForm()
return flask.render_template('view.html', torrent=torrent,
files=files,
comment_form=comment_form,
comments=comments,
comments=torrent_comments,
can_edit=can_edit,
report_form=report_form)