This commit is contained in:
parent
1073d2c1ea
commit
e4b00b04e9
@ -114,13 +114,6 @@ def list_animes(url_filters='nyaa,yggtorrent'):
|
|||||||
return render_template('list.html', search_form=SearchForm(), titles=results)
|
return render_template('list.html', search_form=SearchForm(), titles=results)
|
||||||
|
|
||||||
|
|
||||||
def remove_garbage(link):
|
|
||||||
title = link.title
|
|
||||||
if title and not len(title.links):
|
|
||||||
db.session.delete(title)
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin', methods=['GET', 'POST'])
|
@app.route('/admin', methods=['GET', 'POST'])
|
||||||
@mysql_required
|
@mysql_required
|
||||||
@auth.login_required
|
@auth.login_required
|
||||||
@ -133,7 +126,11 @@ def admin():
|
|||||||
form.message = '%s (%s) has been successfully deleted' % (link.title.name, link.season)
|
form.message = '%s (%s) has been successfully deleted' % (link.title.name, link.season)
|
||||||
db.session.delete(link)
|
db.session.delete(link)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
remove_garbage(link)
|
|
||||||
|
title = link.title
|
||||||
|
if title and not len(title.links):
|
||||||
|
db.session.delete(title)
|
||||||
|
db.session.commit()
|
||||||
else:
|
else:
|
||||||
form._errors = {'id': ['Id %s was not found in the database' % form.id.data]}
|
form._errors = {'id': ['Id %s was not found in the database' % form.id.data]}
|
||||||
|
|
||||||
@ -230,7 +227,6 @@ def admin_edit(link_id=None):
|
|||||||
# Database
|
# Database
|
||||||
db.session.add(link)
|
db.session.add(link)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
remove_garbage(link)
|
|
||||||
|
|
||||||
# Transmission
|
# Transmission
|
||||||
if TRANSMISSION_ENABLED and isinstance(instance, Nyaa):
|
if TRANSMISSION_ENABLED and isinstance(instance, Nyaa):
|
||||||
|
Reference in New Issue
Block a user