Skip to content

Commit

Permalink
Merge pull request #3083 from hughrun/file-resubmit
Browse files Browse the repository at this point in the history
use bw-file-resubmit to retain images during validation checks
  • Loading branch information
mouse-reeve committed Nov 29, 2023
2 parents cf1afef + 1bedcda commit 193a363
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 3 additions & 4 deletions bookwyrm/forms/books.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -70,9 +71,7 @@ class Meta:
"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"}
),
Expand Down
13 changes: 11 additions & 2 deletions bookwyrm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.humanize",
"file_resubmit",
"sass_processor",
"bookwyrm",
"celery",
Expand Down Expand Up @@ -242,7 +243,11 @@
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 = {
Expand All @@ -252,7 +257,11 @@
"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"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 193a363

Please sign in to comment.