diff --git a/Dockerfile b/Dockerfile index 55aba11..ac02366 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,8 @@ COPY . /opt/services/djangoapp/src RUN poetry install --no-dev COPY resources/s6-rc.d /etc/s6-overlay/s6-rc.d +COPY resources/run /opt/services/djangoapp/run + ARG S6_VERSION=3.1.0.1 ARG S6_URL=https://github.com/just-containers/s6-overlay/releases/download RUN arch="$(dpkg --print-architecture)"; \ @@ -36,3 +38,4 @@ EXPOSE 8000 ENTRYPOINT ["/init"] # TODO: change to an app user? +CMD ["/command/with-contenv", "../run"] diff --git a/docker-compose.yml b/docker-compose.yml index 27fcfa3..dbf06ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: - .env environment: DOCKER_ENV: 'on' + S6_KILL_GRACETIME: 1 volumes: - requirements_volume:/opt/services/djangoapp/requirements - static_volume:/opt/services/djangoapp/static diff --git a/formative/admin/formative.py b/formative/admin/formative.py index f7f9b50..de5d732 100644 --- a/formative/admin/formative.py +++ b/formative/admin/formative.py @@ -26,7 +26,7 @@ from ..filetype import FileType from ..plugins import get_matching_plugin from ..signals import register_program_settings, register_form_settings, \ - register_user_actions, form_published_changed + register_user_actions, form_published_changed, form_settings_changed from ..tasks import timed_complete_form from ..utils import submission_link from .actions import UserActionsMixin, FormActionsMixin,FormBlockActionsMixin, \ @@ -193,7 +193,11 @@ def save_form(self, request, form, change): timed_complete_form.apply_async(args=(obj.id, val), eta=val) return obj - + + def save_model(self, request, obj, form, change): + super().save_model(request, obj, form, change) + form_settings_changed.send(obj, changed_data=form.changed_data) + def response_post_save_change(self, request, obj): app_label = self.model._meta.app_label url = reverse('admin:%s_formblock_formlist' % (app_label,), diff --git a/formative/signals.py b/formative/signals.py index c6e3906..4f6bd3f 100644 --- a/formative/signals.py +++ b/formative/signals.py @@ -314,6 +314,8 @@ def send(self, sender, **kwargs): register_form_settings = FormPluginSignal() +form_settings_changed = FormPluginSignal() + submission_review_pre = FormPluginSignal() submission_review_post = FormPluginSignal() diff --git a/poetry.lock b/poetry.lock index 17d2a55..b1cbf8d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -773,7 +773,7 @@ reviewpanel = ["reviewpanel"] [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "aad2e3d6c34206f5ccd18e844b7e9157b79735c91b3ece4e6752526b5d81f89d" +content-hash = "669b8aaf2d67058f8c437f9de2ddb76135b7315ec5249419a0a480d5116aa36b" [metadata.files] amqp = [ diff --git a/pyproject.toml b/pyproject.toml index 54f2084..311645f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ django-better-admin-arrayfield = "^1.4.2" django-admin-inline-paginator = "*" whitenoise = "^6.0.0" reportlab = "*" -reviewpanel = { version = "^0.8.0", optional = true } +reviewpanel = { version = "^0.8.1", optional = true } [tool.poetry.dev-dependencies] pytest = "*" diff --git a/resources/s6-rc.d/djangoapp/run b/resources/run similarity index 100% rename from resources/s6-rc.d/djangoapp/run rename to resources/run diff --git a/resources/s6-rc.d/djangoapp/dependencies.d/redis b/resources/s6-rc.d/djangoapp/dependencies.d/redis deleted file mode 100644 index e69de29..0000000 diff --git a/resources/s6-rc.d/djangoapp/dependencies.d/setup3 b/resources/s6-rc.d/djangoapp/dependencies.d/setup3 deleted file mode 100644 index e69de29..0000000 diff --git a/resources/s6-rc.d/djangoapp/finish b/resources/s6-rc.d/djangoapp/finish deleted file mode 100644 index 54007bd..0000000 --- a/resources/s6-rc.d/djangoapp/finish +++ /dev/null @@ -1,3 +0,0 @@ -#!/command/execlineb -S2 - -s6-svscanctl -t /run/service diff --git a/resources/s6-rc.d/djangoapp/type b/resources/s6-rc.d/djangoapp/type deleted file mode 100644 index 5883cff..0000000 --- a/resources/s6-rc.d/djangoapp/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/resources/s6-rc.d/setup1/up b/resources/s6-rc.d/setup1/up old mode 100755 new mode 100644 index e56cfdf..691ec95 --- a/resources/s6-rc.d/setup1/up +++ b/resources/s6-rc.d/setup1/up @@ -1,4 +1,4 @@ -#!/command/execlineb -P +# execline cd /opt/services/djangoapp/requirements foreground { touch requirements.txt } diff --git a/resources/s6-rc.d/setup2/up b/resources/s6-rc.d/setup2/up old mode 100755 new mode 100644 index b4e8296..44066a2 --- a/resources/s6-rc.d/setup2/up +++ b/resources/s6-rc.d/setup2/up @@ -1,4 +1,4 @@ -#!/command/execlineb -P +# execline cd /opt/services/djangoapp/src with-contenv diff --git a/resources/s6-rc.d/setup3/up b/resources/s6-rc.d/setup3/up old mode 100755 new mode 100644 index 3a5de1a..2cb26ce --- a/resources/s6-rc.d/setup3/up +++ b/resources/s6-rc.d/setup3/up @@ -1,6 +1,10 @@ -#!/command/execlineb -P +# execline cd /opt/services/djangoapp/src -# if { test -n $AUTO_MIGRATE } i don't know how with-contenv +if -t +{ + importas -D "" AUTO_MIGRATE AUTO_MIGRATE + test -n ${AUTO_MIGRATE} +} python3 manage.py migrate --noinput diff --git a/resources/s6-rc.d/user/contents.d/djangoapp b/resources/s6-rc.d/user/contents.d/djangoapp deleted file mode 100644 index e69de29..0000000 diff --git a/templates/admin/formative/formblock/change_form.html b/templates/admin/formative/formblock/change_form.html index 7a1a43c..e289227 100644 --- a/templates/admin/formative/formblock/change_form.html +++ b/templates/admin/formative/formblock/change_form.html @@ -25,7 +25,7 @@ {% else %} {% if form_id %} - {% else %} + {% elif original.form %} {% endif %} {% endif %}