mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 08:00:00 +00:00
Further cleanup
This commit is contained in:
parent
bd4eba9ab7
commit
a7558823d0
|
@ -186,7 +186,7 @@ class TorrentBase(DeclarativeHelperBase):
|
||||||
@declarative.declared_attr
|
@declarative.declared_attr
|
||||||
def trackers(cls):
|
def trackers(cls):
|
||||||
return db.relationship(cls._flavor_prefix('TorrentTrackers'), uselist=True,
|
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'))
|
order_by=cls._flavor_prefix('TorrentTrackers.order'))
|
||||||
|
|
||||||
@declarative.declared_attr
|
@declarative.declared_attr
|
||||||
|
@ -498,8 +498,7 @@ class User(db.Model):
|
||||||
|
|
||||||
bans = db.relationship('Ban', uselist=True, foreign_keys='Ban.user_id')
|
bans = db.relationship('Ban', uselist=True, foreign_keys='Ban.user_id')
|
||||||
|
|
||||||
preferences = db.relationship('UserPreferences',
|
preferences = db.relationship('UserPreferences', back_populates='user', uselist=False)
|
||||||
back_populates='user', uselist=False, lazy='select')
|
|
||||||
|
|
||||||
def __init__(self, username, email, password):
|
def __init__(self, username, email, password):
|
||||||
self.username = username
|
self.username = username
|
||||||
|
|
|
@ -24,8 +24,6 @@ def view_torrent(torrent_id):
|
||||||
.options(joinedload('filelist')) \
|
.options(joinedload('filelist')) \
|
||||||
.filter_by(id=torrent_id) \
|
.filter_by(id=torrent_id) \
|
||||||
.first()
|
.first()
|
||||||
comments = models.Comment.query \
|
|
||||||
.filter_by(torrent_id=torrent_id)
|
|
||||||
|
|
||||||
if not torrent:
|
if not torrent:
|
||||||
flask.abort(404)
|
flask.abort(404)
|
||||||
|
@ -69,11 +67,15 @@ def view_torrent(torrent_id):
|
||||||
if torrent.filelist:
|
if torrent.filelist:
|
||||||
files = json.loads(torrent.filelist.filelist_blob.decode('utf-8'))
|
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()
|
report_form = forms.ReportForm()
|
||||||
return flask.render_template('view.html', torrent=torrent,
|
return flask.render_template('view.html', torrent=torrent,
|
||||||
files=files,
|
files=files,
|
||||||
comment_form=comment_form,
|
comment_form=comment_form,
|
||||||
comments=comments,
|
comments=torrent_comments,
|
||||||
can_edit=can_edit,
|
can_edit=can_edit,
|
||||||
report_form=report_form)
|
report_form=report_form)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue