displays the tags on edit correctly now
-before it was running the tags field through the submit filter. that was kind of dumb -removes the filter function from the edit form -adds unicode syntax in the filter function -uses split correctly when saving the edited tags to mongodb
This commit is contained in:
parent
cdf538bd61
commit
93e3468a2a
@ -27,7 +27,7 @@ class EditForm(wtforms.Form):
|
|||||||
slug = wtforms.TextField(
|
slug = wtforms.TextField(
|
||||||
'Slug')
|
'Slug')
|
||||||
description = wtforms.TextAreaField('Description of this work')
|
description = wtforms.TextAreaField('Description of this work')
|
||||||
tags = wtforms.TextField('Tags', filters=[convert_to_tag_list])
|
tags = wtforms.TextField('Tags')
|
||||||
|
|
||||||
class EditProfileForm(wtforms.Form):
|
class EditProfileForm(wtforms.Form):
|
||||||
bio = wtforms.TextAreaField('Bio',
|
bio = wtforms.TextAreaField('Bio',
|
||||||
|
@ -62,7 +62,7 @@ def edit_media(request, media):
|
|||||||
media['description']))
|
media['description']))
|
||||||
|
|
||||||
media['slug'] = request.POST['slug']
|
media['slug'] = request.POST['slug']
|
||||||
media['tags'] = split(request.POST['tags'])
|
media['tags'] = request.POST['tags'].split(TAGS_DELIMITER)
|
||||||
media.save()
|
media.save()
|
||||||
|
|
||||||
return redirect(request, "mediagoblin.user_pages.media_home",
|
return redirect(request, "mediagoblin.user_pages.media_home",
|
||||||
|
@ -370,7 +370,7 @@ def clean_html(html):
|
|||||||
return HTML_CLEANER.clean_html(html)
|
return HTML_CLEANER.clean_html(html)
|
||||||
|
|
||||||
|
|
||||||
TAGS_DELIMITER = ' '
|
TAGS_DELIMITER = u' '
|
||||||
|
|
||||||
def convert_to_tag_list(tag_string):
|
def convert_to_tag_list(tag_string):
|
||||||
"""
|
"""
|
||||||
@ -381,7 +381,7 @@ def convert_to_tag_list(tag_string):
|
|||||||
"""
|
"""
|
||||||
if tag_string:
|
if tag_string:
|
||||||
taglist = []
|
taglist = []
|
||||||
stripped_tag_string = ' '.join(tag_string.strip().split())
|
stripped_tag_string = u' '.join(tag_string.strip().split())
|
||||||
for tag in stripped_tag_string.split(TAGS_DELIMITER):
|
for tag in stripped_tag_string.split(TAGS_DELIMITER):
|
||||||
if tag.strip(): taglist.append(tag.strip())
|
if tag.strip(): taglist.append(tag.strip())
|
||||||
return taglist
|
return taglist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user