fixes recipe export
This commit is contained in:
parent
9cb1c21cd8
commit
fd70adf19d
@ -9,8 +9,8 @@ from django_scopes import scopes_disabled
|
|||||||
from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField
|
from django_scopes.forms import SafeModelChoiceField, SafeModelMultipleChoiceField
|
||||||
from hcaptcha.fields import hCaptchaField
|
from hcaptcha.fields import hCaptchaField
|
||||||
|
|
||||||
from .models import (Comment, Food, InviteLink, Keyword, MealPlan, MealType, Recipe, RecipeBook,
|
from .models import (Comment, Food, InviteLink, Keyword, Recipe, RecipeBook, RecipeBookEntry,
|
||||||
RecipeBookEntry, SearchPreference, Space, Storage, Sync, User, UserPreference)
|
SearchPreference, Space, Storage, Sync, User, UserPreference)
|
||||||
|
|
||||||
|
|
||||||
class SelectWidget(widgets.Select):
|
class SelectWidget(widgets.Select):
|
||||||
|
@ -4,17 +4,14 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load l10n %}
|
{% load l10n %}
|
||||||
|
|
||||||
|
|
||||||
{% block title %}{% trans 'Export Recipes' %}{% endblock %}
|
{% block title %}{% trans 'Export Recipes' %}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<export-view></export-view>
|
<export-view></export-view>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{% if debug %}
|
{% if debug %}
|
||||||
<script src="{% url 'js_reverse' %}"></script>
|
<script src="{% url 'js_reverse' %}"></script>
|
||||||
@ -23,11 +20,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
window.EXPORT_ID = {{pk}};
|
{% if pk %}
|
||||||
|
window.EXPORT_ID = {{ pk }}
|
||||||
|
{% else %}
|
||||||
|
window.EXPORT_ID = null
|
||||||
|
{% endif %}
|
||||||
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}';
|
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% render_bundle 'export_view' %}
|
{% render_bundle 'export_view' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,15 +7,12 @@
|
|||||||
{% block title %}{% trans 'Export' %}{% endblock %}
|
{% block title %}{% trans 'Export' %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<export-response-view></export-response-view>
|
<export-response-view></export-response-view>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{% if debug %}
|
{% if debug %}
|
||||||
<script src="{% url 'js_reverse' %}"></script>
|
<script src="{% url 'js_reverse' %}"></script>
|
||||||
@ -24,7 +21,11 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
window.EXPORT_ID = {{pk}};
|
{% if pk %}
|
||||||
|
window.EXPORT_ID = {{ pk }}
|
||||||
|
{% else %}
|
||||||
|
window.EXPORT_ID = null
|
||||||
|
{% endif %}
|
||||||
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
|
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
{{ $t("If download did not start automatically: ") }}
|
{{ $t("If download did not start automatically: ") }}
|
||||||
|
|
||||||
<template v-if="export_info.expired">
|
<template v-if="export_info.expired">
|
||||||
<a disabled
|
<a disabled ref="downloadAnchor">
|
||||||
><del>{{ $t("Download") }}</del></a
|
<del>{{ $t("Download") }}</del>
|
||||||
>
|
</a>
|
||||||
({{ $t("Expired") }})
|
({{ $t("Expired") }})
|
||||||
</template>
|
</template>
|
||||||
<a v-else :href="`${resolveDjangoUrl('view_export_file', export_id)}`" ref="downloadAnchor">{{ $t("Download") }}</a>
|
<a v-else :href="`${resolveDjangoUrl('view_export_file', export_id)}`" ref="downloadAnchor">{{ $t("Download") }}</a>
|
||||||
@ -53,20 +53,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from "vue"
|
|
||||||
import { BootstrapVue } from "bootstrap-vue"
|
import { BootstrapVue } from "bootstrap-vue"
|
||||||
|
import Vue from "vue"
|
||||||
|
|
||||||
import "bootstrap-vue/dist/bootstrap-vue.css"
|
import "bootstrap-vue/dist/bootstrap-vue.css"
|
||||||
|
|
||||||
import { ResolveUrlMixin, makeToast, ToastMixin } from "@/utils/utils"
|
import { ResolveUrlMixin, ToastMixin, makeToast } from "@/utils/utils"
|
||||||
|
|
||||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
import LoadingSpinner from "@/components/LoadingSpinner"
|
||||||
|
|
||||||
import { ApiApiFactory } from "@/utils/openapi/api.ts"
|
import { ApiApiFactory } from "@/utils/openapi/api.ts"
|
||||||
|
import VueSanitize from "vue-sanitize"
|
||||||
|
|
||||||
Vue.use(BootstrapVue)
|
Vue.use(BootstrapVue)
|
||||||
import VueSanitize from "vue-sanitize";
|
Vue.use(VueSanitize)
|
||||||
Vue.use(VueSanitize);
|
|
||||||
export default {
|
export default {
|
||||||
name: "ExportResponseView",
|
name: "ExportResponseView",
|
||||||
mixins: [ResolveUrlMixin, ToastMixin],
|
mixins: [ResolveUrlMixin, ToastMixin],
|
||||||
|
@ -45,14 +45,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from "vue"
|
|
||||||
import { BootstrapVue } from "bootstrap-vue"
|
import { BootstrapVue } from "bootstrap-vue"
|
||||||
|
import Vue from "vue"
|
||||||
|
|
||||||
import "bootstrap-vue/dist/bootstrap-vue.css"
|
import "bootstrap-vue/dist/bootstrap-vue.css"
|
||||||
|
|
||||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
import { ApiMixin, StandardToasts, makeToast, resolveDjangoUrl } from "@/utils/utils"
|
||||||
|
|
||||||
import { StandardToasts, makeToast, resolveDjangoUrl, ApiMixin } from "@/utils/utils"
|
|
||||||
// import Multiselect from "vue-multiselect"
|
// import Multiselect from "vue-multiselect"
|
||||||
import GenericMultiselect from "@/components/GenericMultiselect"
|
import GenericMultiselect from "@/components/GenericMultiselect"
|
||||||
import { ApiApiFactory } from "@/utils/openapi/api.ts"
|
import { ApiApiFactory } from "@/utils/openapi/api.ts"
|
||||||
@ -108,7 +106,7 @@ export default {
|
|||||||
let formData = new FormData()
|
let formData = new FormData()
|
||||||
formData.append("type", this.recipe_app)
|
formData.append("type", this.recipe_app)
|
||||||
formData.append("all", this.export_all)
|
formData.append("all", this.export_all)
|
||||||
formData.append("custom_filter", this.filter?.id ?? null)
|
formData.append("custom_filter", this.filter?.id ?? "")
|
||||||
|
|
||||||
for (var i = 0; i < this.recipe_list.length; i++) {
|
for (var i = 0; i < this.recipe_list.length; i++) {
|
||||||
formData.append("recipes", this.recipe_list[i].id)
|
formData.append("recipes", this.recipe_list[i].id)
|
||||||
|
Loading…
Reference in New Issue
Block a user