aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/admin/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/admin/views.py')
-rw-r--r--mediagoblin/admin/views.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/mediagoblin/admin/views.py b/mediagoblin/admin/views.py
index 9c14c55c..22ca74a3 100644
--- a/mediagoblin/admin/views.py
+++ b/mediagoblin/admin/views.py
@@ -14,10 +14,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from mediagoblin.db.util import DESCENDING
+from werkzeug.exceptions import Forbidden
+
+from mediagoblin.db.models import MediaEntry
from mediagoblin.decorators import require_active_login
-from mediagoblin.tools.response import (render_to_response, render_403,
- render_404)
+from mediagoblin.tools.response import render_to_response
@require_active_login
def admin_processing_panel(request):
@@ -26,17 +27,17 @@ def admin_processing_panel(request):
'''
# TODO: Why not a "require_admin_login" decorator throwing a 403 exception?
if not request.user.is_admin:
- return render_403(request)
+ raise Forbidden()
- processing_entries = request.db.MediaEntry.find(
- {'state': u'processing'}).sort('created', DESCENDING)
+ processing_entries = MediaEntry.query.filter_by(state = u'processing').\
+ order_by(MediaEntry.created.desc())
# Get media entries which have failed to process
- failed_entries = request.db.MediaEntry.find(
- {'state': u'failed'}).sort('created', DESCENDING)
+ failed_entries = MediaEntry.query.filter_by(state = u'failed').\
+ order_by(MediaEntry.created.desc())
- processed_entries = request.db.MediaEntry.find(
- {'state': u'processed'}).sort('created', DESCENDING).limit(10)
+ processed_entries = MediaEntry.query.filter_by(state = u'processed').\
+ order_by(MediaEntry.created.desc()).limit(10)
# Render to response
return render_to_response(