Commit | Line | Data |
---|---|---|
808eac00 JW |
1 | # GNU MediaGoblin -- federated, autonomous media hosting |
2 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. | |
3 | # | |
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | from mediagoblin.tools.response import render_to_response, render_404 | |
18 | from mediagoblin.db.util import DESCENDING | |
19 | from mediagoblin.decorators import require_active_login | |
20 | ||
21 | ||
22 | @require_active_login | |
23 | def admin_processing_panel(request): | |
24 | ''' | |
25 | Show the global processing panel for this instance | |
26 | ''' | |
27 | if not request.user.is_admin: | |
28 | return render_404(request) | |
29 | ||
30 | processing_entries = request.db.MediaEntry.find( | |
31 | {'state': u'processing'}).sort('created', DESCENDING) | |
32 | ||
33 | # Get media entries which have failed to process | |
34 | failed_entries = request.db.MediaEntry.find( | |
35 | {'state': u'failed'}).sort('created', DESCENDING) | |
36 | ||
37 | processed_entries = request.db.MediaEntry.find( | |
38 | {'state': u'processed'}).sort('created', DESCENDING).limit(10) | |
39 | ||
40 | # Render to response | |
41 | return render_to_response( | |
42 | request, | |
43 | 'mediagoblin/admin/panel.html', | |
44 | {'processing_entries': processing_entries, | |
45 | 'failed_entries': failed_entries, | |
46 | 'processed_entries': processed_entries}) |