broke
This commit is contained in:
@ -13,6 +13,7 @@ from app import db
|
||||
from plugins.auth.models import User
|
||||
from plugins.plant.growlog.models import GrowLog
|
||||
from plugins.plant.models import Plant
|
||||
from plugins.media.models import Media
|
||||
from plugins.admin.models import AnalyticsEvent
|
||||
from .forms import UserForm
|
||||
|
||||
@ -332,3 +333,12 @@ def undelete_user(user_id):
|
||||
page=request.args.get('page'),
|
||||
show_deleted=request.args.get('show_deleted'),
|
||||
q=request.args.get('q')))
|
||||
|
||||
|
||||
@bp.route('/orphaned-media')
|
||||
@login_required
|
||||
def orphaned_media_list():
|
||||
if not current_user.role == 'admin':
|
||||
abort(403)
|
||||
items = Media.query.filter_by(status='orphaned').order_by(Media.orphaned_at.desc()).all()
|
||||
return render_template('admin/orphaned_media_list.html', items=items)
|
33
plugins/admin/templates/admin/orphaned_media_list.html
Normal file
33
plugins/admin/templates/admin/orphaned_media_list.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!-- plugins/admin/templates/admin/orphaned_media_list.html -->
|
||||
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% block title %}Orphaned Media – Admin – Nature In Pots{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Orphaned Media</h1>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Original URL</th>
|
||||
<th>New URL</th>
|
||||
<th>Orphaned At</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for m in items %}
|
||||
<tr>
|
||||
<td>{{ m.id }}</td>
|
||||
<td><a href="{{ m.original_file_url }}" target="_blank">{{ m.original_file_url }}</a></td>
|
||||
<td><a href="{{ m.file_url }}" target="_blank">{{ m.file_url }}</a></td>
|
||||
<td>{{ m.orphaned_at.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="text-center">No orphaned media found.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user