Skip to content

Instantly share code, notes, and snippets.

@johnfraney
Created April 3, 2019 20:39
Show Gist options
  • Save johnfraney/99b1b0c9aba9e1c7ce13d58cd59c3968 to your computer and use it in GitHub Desktop.
Save johnfraney/99b1b0c9aba9e1c7ce13d58cd59c3968 to your computer and use it in GitHub Desktop.
diff --git a/wagtailmedia/tests/test_views.py b/wagtailmedia/tests/test_views.py
index abbd40b..9df269f 100644
--- a/wagtailmedia/tests/test_views.py
+++ b/wagtailmedia/tests/test_views.py
@@ -484,7 +484,7 @@ class TestMediaChooserView(TestCase, WagtailTestUtils):
response = self.client.get(reverse('wagtailmedia:chooser'))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailmedia/chooser/chooser.html')
- self.assertTemplateUsed(response, 'wagtailmedia/chooser/chooser.js')
+ self.assertTemplateUsed(response, 'wagtailmedia/chooser/chooser.html')
def test_search(self):
response = self.client.get(reverse('wagtailmedia:chooser'), {'q': "Hello"})
@@ -552,7 +552,6 @@ class TestMediaChooserChosenView(TestCase, WagtailTestUtils):
def test_simple(self):
response = self.client.get(reverse('wagtailmedia:media_chosen', args=(self.media.id,)))
self.assertEqual(response.status_code, 200)
- self.assertTemplateUsed(response, 'wagtailmedia/chooser/media_chosen.js')
class TestMediaFilenameProperties(TestCase):
@@ -669,4 +668,4 @@ class TestGetUsage(TestCase, WagtailTestUtils):
response = self.client.get(reverse('wagtailmedia:media_usage',
args=(1,)))
# There's no usage so there should be no table rows
- self.assertRegex(response.content, b'<tbody>(\s|\n)*</tbody>')
+ self.assertRegex(response.content, b'<tbody>(\\s|\n)*</tbody>')
diff --git a/wagtailmedia/views/chooser.py b/wagtailmedia/views/chooser.py
index c512209..ed35dd3 100644
--- a/wagtailmedia/views/chooser.py
+++ b/wagtailmedia/views/chooser.py
@@ -1,5 +1,3 @@
-import json
-
from django.shortcuts import get_object_or_404, render
from wagtailmedia.models import get_media_model
@@ -72,14 +70,23 @@ def chooser(request):
media_files = Media.objects.order_by('-created_at')
paginator, media_files = paginate(request, media_files, per_page=10)
- return render_modal_workflow(request, 'wagtailmedia/chooser/chooser.html', None, {
- 'media_files': media_files,
- 'searchform': searchform,
- 'collections': collections,
- 'is_searching': False,
- }, json_data={'step': 'chooser','error_label': "Server Error",
- 'error_message': "Report this error to your webmaster with the following information:",
- 'tag_autocomplete_url': reverse('wagtailadmin_tag_autocomplete'),})
+ return render_modal_workflow(
+ request,
+ 'wagtailmedia/chooser/chooser.html',
+ None,
+ {
+ 'media_files': media_files,
+ 'searchform': searchform,
+ 'collections': collections,
+ 'is_searching': False,
+ },
+ json_data={
+ 'step': 'chooser',
+ 'error_label': "Server Error",
+ 'error_message': "Report this error to your webmaster with the following information:",
+ 'tag_autocomplete_url': reverse('wagtailadmin_tag_autocomplete'),
+ }
+ )
def media_chosen(request, media_id):
diff --git a/wagtailmedia/wagtail_hooks.py b/wagtailmedia/wagtail_hooks.py
index e0bb12d..1f76afe 100644
--- a/wagtailmedia/wagtail_hooks.py
+++ b/wagtailmedia/wagtail_hooks.py
@@ -1,6 +1,5 @@
from django.conf.urls import include, url
-from django.contrib.staticfiles.templatetags.staticfiles import static
-from django.utils.html import format_html, format_html_join
+from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment