adds filter function to parse and clean tags field input
- for some reason the tags are showing up in the media edit form with u'..' and surrounded with []. I don't know why, grr
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
|
||||
import wtforms
|
||||
|
||||
from mediagoblin.util import convert_to_tag_list
|
||||
|
||||
|
||||
class EditForm(wtforms.Form):
|
||||
title = wtforms.TextField(
|
||||
@@ -25,8 +27,7 @@ class EditForm(wtforms.Form):
|
||||
slug = wtforms.TextField(
|
||||
'Slug')
|
||||
description = wtforms.TextAreaField('Description of this work')
|
||||
tags = wtforms.TextField(
|
||||
'Tags')
|
||||
tags = wtforms.TextField('Tags', filters=[convert_to_tag_list])
|
||||
|
||||
class EditProfileForm(wtforms.Form):
|
||||
bio = wtforms.TextAreaField('Bio',
|
||||
|
||||
@@ -19,7 +19,8 @@ from webob import exc
|
||||
from string import split
|
||||
|
||||
from mediagoblin import messages
|
||||
from mediagoblin.util import render_to_response, redirect, clean_html
|
||||
from mediagoblin.util import render_to_response, redirect, clean_html, \
|
||||
TAGS_DELIMITER
|
||||
from mediagoblin.edit import forms
|
||||
from mediagoblin.edit.lib import may_edit_media
|
||||
from mediagoblin.decorators import require_active_login, get_user_media_entry
|
||||
@@ -37,7 +38,7 @@ def edit_media(request, media):
|
||||
title = media['title'],
|
||||
slug = media['slug'],
|
||||
description = media['description'],
|
||||
tags = ' '.join(media['tags']))
|
||||
tags = TAGS_DELIMITER.join(media['tags']))
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
# Make sure there isn't already a MediaEntry with such a slug
|
||||
|
||||
Reference in New Issue
Block a user