F360(tagging) - adds tag fields for submission, edit and display
This commit is contained in:
parent
e6fd112d42
commit
04a9515064
@ -25,6 +25,8 @@ 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')
|
||||||
|
|
||||||
class EditProfileForm(wtforms.Form):
|
class EditProfileForm(wtforms.Form):
|
||||||
bio = wtforms.TextAreaField('Bio',
|
bio = wtforms.TextAreaField('Bio',
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
from webob import exc
|
from webob import exc
|
||||||
|
from string import split
|
||||||
|
|
||||||
from mediagoblin import messages
|
from mediagoblin import messages
|
||||||
from mediagoblin.util import render_to_response, redirect, clean_html
|
from mediagoblin.util import render_to_response, redirect, clean_html
|
||||||
@ -35,7 +36,8 @@ def edit_media(request, media):
|
|||||||
form = forms.EditForm(request.POST,
|
form = forms.EditForm(request.POST,
|
||||||
title = media['title'],
|
title = media['title'],
|
||||||
slug = media['slug'],
|
slug = media['slug'],
|
||||||
description = media['description'])
|
description = media['description'],
|
||||||
|
tags = ' '.join(media['tags']))
|
||||||
|
|
||||||
if request.method == 'POST' and form.validate():
|
if request.method == 'POST' and form.validate():
|
||||||
# Make sure there isn't already a MediaEntry with such a slug
|
# Make sure there isn't already a MediaEntry with such a slug
|
||||||
@ -59,6 +61,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.save()
|
media.save()
|
||||||
|
|
||||||
return redirect(request, "mediagoblin.user_pages.media_home",
|
return redirect(request, "mediagoblin.user_pages.media_home",
|
||||||
|
@ -24,3 +24,4 @@ class SubmitStartForm(wtforms.Form):
|
|||||||
[wtforms.validators.Length(min=0, max=500)])
|
[wtforms.validators.Length(min=0, max=500)])
|
||||||
description = wtforms.TextAreaField('Description of this work')
|
description = wtforms.TextAreaField('Description of this work')
|
||||||
file = wtforms.FileField('File')
|
file = wtforms.FileField('File')
|
||||||
|
tags = wtforms.TextField('Tags')
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
from os.path import splitext
|
from os.path import splitext
|
||||||
from cgi import FieldStorage
|
from cgi import FieldStorage
|
||||||
|
from string import split
|
||||||
|
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ def submit_start(request):
|
|||||||
|
|
||||||
entry['media_type'] = u'image' # heh
|
entry['media_type'] = u'image' # heh
|
||||||
entry['uploader'] = request.user['_id']
|
entry['uploader'] = request.user['_id']
|
||||||
|
entry['tags'] = split(request.POST.get('tags'))
|
||||||
|
|
||||||
# Save, just so we can get the entry id for the sake of using
|
# Save, just so we can get the entry id for the sake of using
|
||||||
# it to generate the file path
|
# it to generate the file path
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
<div class="grid_8 prefix_1 suffix_1 form_box">
|
<div class="grid_8 prefix_1 suffix_1 form_box">
|
||||||
<h1>Submit yer media</h1>
|
<h1>Submit yer media</h1>
|
||||||
{{ wtforms_util.render_field_div(submit_form.file) }}
|
{{ wtforms_util.render_field_div(submit_form.file) }}
|
||||||
|
{{ wtforms_util.render_field_div(submit_form.tags) }}
|
||||||
{{ wtforms_util.render_field_div(submit_form.title) }}
|
{{ wtforms_util.render_field_div(submit_form.title) }}
|
||||||
{{ wtforms_util.render_textarea_div(submit_form.description) }}
|
{{ wtforms_util.render_textarea_div(submit_form.description) }}
|
||||||
<div class="form_submit_buttons">
|
<div class="form_submit_buttons">
|
||||||
|
@ -48,6 +48,10 @@
|
|||||||
user= media.uploader().username) }}">
|
user= media.uploader().username) }}">
|
||||||
{{- media.uploader().username }}</a>
|
{{- media.uploader().username }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ ' '.join(media.tags) }}
|
||||||
|
</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<h3>Comments</h3>
|
<h3>Comments</h3>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user