diff --git a/bookwyrm/forms/books.py b/bookwyrm/forms/books.py index 4885dc063..f73ce3f5a 100644 --- a/bookwyrm/forms/books.py +++ b/bookwyrm/forms/books.py @@ -1,8 +1,9 @@ """ using django model forms """ from django import forms +from file_resubmit.widgets import ResubmitImageWidget + from bookwyrm import models -from bookwyrm.models.fields import ClearableFileInputWithWarning from .custom_form import CustomForm from .widgets import ArrayWidget, SelectDateWidget, Select @@ -70,9 +71,7 @@ class EditionForm(CustomForm): "published_date": SelectDateWidget( attrs={"aria-describedby": "desc_published_date"} ), - "cover": ClearableFileInputWithWarning( - attrs={"aria-describedby": "desc_cover"} - ), + "cover": ResubmitImageWidget(attrs={"aria-describedby": "desc_cover"}), "physical_format": Select( attrs={"aria-describedby": "desc_physical_format"} ), diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 4cecc4df6..246db6d43 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -99,6 +99,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "django.contrib.humanize", + "file_resubmit", "sass_processor", "bookwyrm", "celery", @@ -242,7 +243,11 @@ if env.bool("USE_DUMMY_CACHE", False): CACHES = { "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", - } + }, + "file_resubmit": { + "BACKEND": "django.core.cache.backends.dummy.DummyCache", + "LOCATION": "/tmp/file_resubmit_tests/", + }, } else: CACHES = { @@ -252,7 +257,11 @@ else: "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", }, - } + }, + "file_resubmit": { + "BACKEND": "django.core.cache.backends.filebased.FileBasedCache", + "LOCATION": "/tmp/file_resubmit/", + }, } SESSION_ENGINE = "django.contrib.sessions.backends.cache" diff --git a/requirements.txt b/requirements.txt index 4ec939c0f..0b09f3c19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ celery==5.2.7 colorthief==0.2.1 Django==3.2.23 django-celery-beat==2.4.0 +bw-file-resubmit==0.6.0rc2 django-compressor==4.3.1 django-imagekit==4.1.0 django-model-utils==4.3.1