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