aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin')
-rw-r--r--mediagoblin/db/models.py16
-rw-r--r--mediagoblin/edit/forms.py3
-rw-r--r--mediagoblin/edit/views.py4
3 files changed, 13 insertions, 10 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 8aa35ca9..2b7933a4 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -148,30 +148,32 @@ class MediaEntry(Document):
Provide a url to the previous entry from this user, if there is one
"""
cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']},
- 'uploader': self['uploader']}).sort(
- '_id', DESCENDING).limit(1)
-
+ 'uploader': self['uploader'],
+ 'state': 'processed'}).sort(
+ '_id', ASCENDING).limit(1)
if cursor.count():
return urlgen('mediagoblin.user_pages.media_home',
user=self.uploader()['username'],
- media=unicode(cursor[0]['_id']))
+ media=unicode(cursor[0]['slug']))
def url_to_next(self, urlgen):
"""
Provide a url to the next entry from this user, if there is one
"""
cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']},
- 'uploader': self['uploader']}).sort(
- '_id', ASCENDING).limit(1)
+ 'uploader': self['uploader'],
+ 'state': 'processed'}).sort(
+ '_id', DESCENDING).limit(1)
if cursor.count():
return urlgen('mediagoblin.user_pages.media_home',
user=self.uploader()['username'],
- media=unicode(cursor[0]['_id']))
+ media=unicode(cursor[0]['slug']))
def uploader(self):
return self.db.User.find_one({'_id': self['uploader']})
+
class MediaComment(Document):
__collection__ = 'media_comments'
diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py
index 2efdb9e4..d5e7f0a9 100644
--- a/mediagoblin/edit/forms.py
+++ b/mediagoblin/edit/forms.py
@@ -31,4 +31,5 @@ class EditProfileForm(wtforms.Form):
[wtforms.validators.Length(min=0, max=500)])
url = wtforms.TextField(
'Website',
- [wtforms.validators.URL(message='Improperly formed URL')])
+ [wtforms.validators.Optional(),
+ wtforms.validators.URL(message='Improperly formed URL')])
diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py
index e064a9c3..a3326b2d 100644
--- a/mediagoblin/edit/views.py
+++ b/mediagoblin/edit/views.py
@@ -106,8 +106,8 @@ def edit_profile(request):
messages.add_message(request,
messages.SUCCESS,
'Profile edited!')
- return redirect(request,
- "mediagoblin.edit.profile",
+ return redirect(request,
+ 'mediagoblin.user_pages.user_home',
username=edit_username)
return render_to_response(