Merge pull request #3083 from hughrun/file-resubmit

use bw-file-resubmit to retain images during validation checks
This commit is contained in:
Mouse Reeve 2023-11-29 15:36:33 -08:00 committed by GitHub
commit 193a36390b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View file

@ -1,8 +1,9 @@
""" using django model forms """ """ using django model forms """
from django import forms from django import forms
from file_resubmit.widgets import ResubmitImageWidget
from bookwyrm import models from bookwyrm import models
from bookwyrm.models.fields import ClearableFileInputWithWarning
from .custom_form import CustomForm from .custom_form import CustomForm
from .widgets import ArrayWidget, SelectDateWidget, Select from .widgets import ArrayWidget, SelectDateWidget, Select
@ -70,9 +71,7 @@ class EditionForm(CustomForm):
"published_date": SelectDateWidget( "published_date": SelectDateWidget(
attrs={"aria-describedby": "desc_published_date"} attrs={"aria-describedby": "desc_published_date"}
), ),
"cover": ClearableFileInputWithWarning( "cover": ResubmitImageWidget(attrs={"aria-describedby": "desc_cover"}),
attrs={"aria-describedby": "desc_cover"}
),
"physical_format": Select( "physical_format": Select(
attrs={"aria-describedby": "desc_physical_format"} attrs={"aria-describedby": "desc_physical_format"}
), ),

View file

@ -99,6 +99,7 @@ INSTALLED_APPS = [
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
"django.contrib.humanize", "django.contrib.humanize",
"file_resubmit",
"sass_processor", "sass_processor",
"bookwyrm", "bookwyrm",
"celery", "celery",
@ -242,7 +243,11 @@ if env.bool("USE_DUMMY_CACHE", False):
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django.core.cache.backends.dummy.DummyCache", "BACKEND": "django.core.cache.backends.dummy.DummyCache",
} },
"file_resubmit": {
"BACKEND": "django.core.cache.backends.dummy.DummyCache",
"LOCATION": "/tmp/file_resubmit_tests/",
},
} }
else: else:
CACHES = { CACHES = {
@ -252,7 +257,11 @@ else:
"OPTIONS": { "OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient", "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" SESSION_ENGINE = "django.contrib.sessions.backends.cache"

View file

@ -4,6 +4,7 @@ celery==5.2.7
colorthief==0.2.1 colorthief==0.2.1
Django==3.2.23 Django==3.2.23
django-celery-beat==2.4.0 django-celery-beat==2.4.0
bw-file-resubmit==0.6.0rc2
django-compressor==4.3.1 django-compressor==4.3.1
django-imagekit==4.1.0 django-imagekit==4.1.0
django-model-utils==4.3.1 django-model-utils==4.3.1