Show images in reverse submit order

Fixes bug #327. Just do a .sort('created', DESCENDING) on Media when
showing them to show the latest first.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2011-05-16 14:55:05 +02:00
parent 400125148f
commit 1ab8467320
2 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from webob import Response, exc from webob import Response, exc
from pymongo import DESCENDING
from mongokit import ObjectId from mongokit import ObjectId
import wtforms import wtforms
@ -29,7 +30,7 @@ def user_home(request):
medias = request.db.MediaEntry.find({ medias = request.db.MediaEntry.find({
'uploader': user, 'uploader': user,
'state': 'processed'}) 'state': 'processed'}).sort('created', DESCENDING)
template = request.template_env.get_template( template = request.template_env.get_template(
'mediagoblin/user_pages/user.html') 'mediagoblin/user_pages/user.html')

View File

@ -18,13 +18,14 @@ import datetime
from webob import Response, exc from webob import Response, exc
import wtforms import wtforms
from pymongo import DESCENDING
from mongokit import ObjectId from mongokit import ObjectId
from mediagoblin import models from mediagoblin import models
import gettext import gettext
def root_view(request): def root_view(request):
media_entries = request.db.MediaEntry.find( media_entries = request.db.MediaEntry.find(
{u'state': u'processed'}) {u'state': u'processed'}).sort('created', DESCENDING)
template = request.template_env.get_template( template = request.template_env.get_template(
'mediagoblin/root.html') 'mediagoblin/root.html')