form.slug.errors.append(
_(u'An entry with that slug already exists for this user.'))
else:
- media['title'] = request.POST['title']
- media['description'] = request.POST.get('description')
+ media['title'] = unicode(request.POST['title'])
+ media['description'] = unicode(request.POST.get('description'))
media['tags'] = convert_to_tag_list_of_dicts(
request.POST.get('tags'))
-
+
media['description_html'] = cleaned_markdown_conversion(
media['description'])
- media['slug'] = request.POST['slug']
+ if 'attachment_name' in request.POST:
+ media['attachment_files'][0]['name'] = \
+ request.POST['attachment_name']
+
+ if 'attachment_delete' in request.POST \
+ and 'y' == request.POST['attachment_delete']:
+ del media['attachment_files'][0]
+
- task_id = unicode(uuid.uuid4())
- media['queued_task_id'] = task_id
+ media['slug'] = unicode(request.POST['slug'])
media.save()
return redirect(request, "mediagoblin.user_pages.media_home",
user = request.user
form = forms.EditProfileForm(request.POST,
- url = user.get('url'),
- bio = user.get('bio'))
+ url=user.get('url'),
+ bio=user.get('bio'))
if request.method == 'POST' and form.validate():
- user['url'] = request.POST['url']
- user['bio'] = request.POST['bio']
+ user['url'] = unicode(request.POST['url'])
+ user['bio'] = unicode(request.POST['bio'])
user['bio_html'] = cleaned_markdown_conversion(user['bio'])
<div class="grid_5 omega">
{% include "mediagoblin/utils/prev_next.html" %}
- {% if media['uploader'] == request.user['_id'] or
- request.user['is_admin'] %}
- <h3>Temporary button holder</h3>
- <p>
- <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
- user= media.uploader().username,
- media= media._id) }}"
- ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
- class="media_icon" />edit</a>
- </p>
- <p>
- <a href="{{ request.urlgen('mediagoblin.confirm.confirm_delete',
- user= media.uploader().username,
- media= media._id) }}"
- ><img src="{{ request.staticdirect('/images/icon_delete.png') }}"
- class="media_icon" />{% trans %}delete{% endtrans %}</a>
- </p>
- {% endif %}
+
+ {% if media['uploader'] == request.user['_id'] or
+ request.user['is_admin'] %}
+ <h3>Temporary button holder</h3>
+ <p>
+ <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
+ user= media.uploader().username,
+ media= media._id) }}"
+ ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
+ class="media_icon" />edit</a>
+ </p>
+ <p>
- <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
- class="media_icon" />{% trans %}delete{% endtrans %}
++ <a href="{{ request.urlgen('mediagoblin.confirm.confirm_delete',
++ user= media.uploader().username,
++ media= media._id) }}"
++ ><img src="{{ request.staticdirect('/images/icon_delete.png') }}"
++ class="media_icon" />{% trans %}delete{% endtrans %}</a>
+ </p>
+ {% endif %}
+
+ {% if media.attachment_files|count %}
+ <h3>Attachments</h3>
+ <ul>
+ {% for attachment in media.attachment_files %}
+ <li>
+ <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
+ {{ attachment.name }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
+ {% if app_config['allow_attachments']
+ and (media['uploader'] == request.user['_id']
+ or request.user['is_admin']) %}
+ <p>
+ <a href="{{ request.urlgen('mediagoblin.edit.attachments',
+ user=media.uploader().username,
+ media=media._id) }}">Add attachment</a>
+ </p>
+ {% endif %}
{% if media.tags %}
{% include "mediagoblin/utils/tags.html" %}
'/{user}/m/{media}/c/{comment}/',
controller="mediagoblin.user_pages.views:media_home"),
Route('mediagoblin.edit.edit_media', "/{user}/m/{media}/edit/",
- controller="mediagoblin.edit.views:edit_media"),
+ controller="mediagoblin.edit.views:edit_media"),
+ Route('mediagoblin.edit.attachments',
+ '/{user}/m/{media}/attachments/',
+ controller="mediagoblin.edit.views:edit_attachments"),
+ Route('mediagoblin.confirm.confirm_delete', "/{user}/m/{media}/confirm/",
+ controller="mediagoblin.confirm.views:confirm_delete"),
Route('mediagoblin.user_pages.atom_feed', '/{user}/atom/',
controller="mediagoblin.user_pages.views:atom_feed"),
Route('mediagoblin.user_pages.media_post_comment',