msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-10-20 13:19+0200\n"
-"PO-Revision-Date: 2011-10-20 13:22+0100\n"
+"POT-Creation-Date: 2011-10-26 12:43+0200\n"
+"PO-Revision-Date: 2011-10-26 12:44+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
msgid "Commit"
msgstr "Zatwierdź"
+#: templates/archive/file_managed.html:103
+msgid "Remove to archive"
+msgstr "Usuń do archiwum"
+
#: templates/archive/file_new.html:8
msgid "Move to archive"
msgstr "Przenieś do archiwum"
+<hr />
+
+
+
+<form method="post" action="{% url remove_to_archive audiobook.id %}">
+ {% csrf_token %}
+ <input type="submit" value="{% trans "Remove to archive" %}" />
+</form>
+
+
{% endblock %}
{% block file-list %}
{% for file in objects %}
<li>
- <a href='{% url file_new file %}'>{{ file }}</a>
+ <a href='{% url file_new file|urlencode %}'>{{ file }}</a>
</li>
{% endfor %}
{% endblock %}
{% block file-list %}
{% for file in objects %}
<li>
- <a href='{% url file_unmanaged file %}'>{{ file }}</a>
+ <a href='{% url file_unmanaged file|urlencode %}'>{{ file }}</a>
</li>
{% endfor %}
{% endblock %}
@register.inclusion_tag('archive/tags/multiple_tags_table.html')
def multiple_tags_table(tags, table=True):
- return locals()
+ new_tags = {}
+ for k, v in tags.items():
+ if isinstance(v, list):
+ new_tags[k] = v
+ else:
+ new_tags[k] = [v]
+ return {"tags": new_tags, "table": table}
@register.inclusion_tag('archive/tags/tags_table.html')
url(r'^file/(\d+)/$', 'archive.views.file_managed', name="file"),
url(r'^publish/(\d+)/$', 'archive.views.publish', name="publish"),
url(r'^cancel/(\d+)/$', 'archive.views.cancel_publishing', name="cancel_publishing"),
+ url(r'^remove_to_archive/(\d+)/$', 'archive.views.remove_to_archive', name="remove_to_archive"),
url(r'^unmanaged/$', 'archive.views.list_unmanaged', name="list_unmanaged"),
url(r'^unmanaged/(.+)/$', 'archive.views.file_unmanaged', name="file_unmanaged"),
return redirect(list_new)
+@require_POST
+@permission_required('archive.change_audiobook')
+def remove_to_archive(request, aid):
+ """ move a managed file to the unmanaged files dir """
+
+ audiobook = get_object_or_404(models.Audiobook, id=aid)
+ old_path = audiobook.source_file.path
+ new_path = os.path.join(settings.UNMANAGED_PATH,
+ str(audiobook.source_file)[len(settings.FILES_SAVE_PATH):].lstrip('/'))
+ new_dir = os.path.split(new_path)[0]
+ if not os.path.isdir(new_dir):
+ os.makedirs(new_dir)
+
+ if not os.path.isfile(old_path):
+ raise Http404
+
+ try:
+ os.link(old_path, new_path)
+ except OSError:
+ # destination file exists, don't overwrite it
+ # TODO: this should probably be more informative
+ return redirect(file_new, filename)
+ else:
+ os.unlink(old_path)
+ audiobook.delete()
+
+ return redirect(list_unmanaged)
+
@require_POST
@permission_required('archive.change_audiobook')
def move_to_new(request, filename):