minor cleanup

This commit is contained in:
smilerz 2022-02-15 06:42:57 -06:00
parent 444e0c1918
commit 4e8bbefc17
No known key found for this signature in database
GPG Key ID: 39444C7606D47126
12 changed files with 32 additions and 43 deletions

View File

@ -128,7 +128,6 @@ class RecipeSearch():
self.unit_filters(units=self._units) self.unit_filters(units=self._units)
self._makenow_filter(missing=self._makenow) self._makenow_filter(missing=self._makenow)
self.string_filters(string=self._string) self.string_filters(string=self._string)
return self._queryset.filter(space=self._request.space).distinct().order_by(*self.orderby) return self._queryset.filter(space=self._request.space).distinct().order_by(*self.orderby)
def _sort_includes(self, *args): def _sort_includes(self, *args):

View File

@ -1,11 +1,14 @@
from gettext import gettext as _
import bleach import bleach
import markdown as md import markdown as md
from bleach_allowlist import markdown_attrs, markdown_tags from bleach_allowlist import markdown_attrs, markdown_tags
from jinja2 import Template, TemplateSyntaxError, UndefinedError
from markdown.extensions.tables import TableExtension
from cookbook.helper.mdx_attributes import MarkdownFormatExtension from cookbook.helper.mdx_attributes import MarkdownFormatExtension
from cookbook.helper.mdx_urlize import UrlizeExtension from cookbook.helper.mdx_urlize import UrlizeExtension
from jinja2 import Template, TemplateSyntaxError, UndefinedError
from gettext import gettext as _
from markdown.extensions.tables import TableExtension
class IngredientObject(object): class IngredientObject(object):
amount = "" amount = ""

View File

@ -1,7 +1,5 @@
from django.contrib.postgres.aggregates import StringAgg from django.contrib.postgres.aggregates import StringAgg
from django.contrib.postgres.search import ( from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector
SearchQuery, SearchRank, SearchVector,
)
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.utils import translation from django.utils import translation

View File

@ -481,6 +481,7 @@ class Unit(ExportModelOperationsMixin('unit'), models.Model, PermissionModelMixi
class Food(ExportModelOperationsMixin('food'), TreeModel, PermissionModelMixin): class Food(ExportModelOperationsMixin('food'), TreeModel, PermissionModelMixin):
# TODO when savings a food as substitute children - assume children and descednants are also substitutes for siblings
# exclude fields not implemented yet # exclude fields not implemented yet
inheritable_fields = FoodInheritField.objects.exclude(field__in=['diet', 'substitute', ]) inheritable_fields = FoodInheritField.objects.exclude(field__in=['diet', 'substitute', ])
# TODO add inherit children_inherit, parent_inherit, Do Not Inherit # TODO add inherit children_inherit, parent_inherit, Do Not Inherit

View File

@ -7,12 +7,9 @@ from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.generic import DeleteView from django.views.generic import DeleteView
from cookbook.helper.permission_helper import (GroupRequiredMixin, from cookbook.helper.permission_helper import GroupRequiredMixin, OwnerRequiredMixin, group_required
OwnerRequiredMixin, from cookbook.models import (Comment, InviteLink, MealPlan, Recipe, RecipeBook, RecipeBookEntry,
group_required) RecipeImport, Storage, Sync)
from cookbook.models import (Comment, InviteLink, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport,
Storage, Sync)
from cookbook.provider.dropbox import Dropbox from cookbook.provider.dropbox import Dropbox
from cookbook.provider.local import Local from cookbook.provider.local import Local
from cookbook.provider.nextcloud import Nextcloud from cookbook.provider.nextcloud import Nextcloud

View File

@ -2,22 +2,16 @@ import os
from django.contrib import messages from django.contrib import messages
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render, redirect from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.generic import UpdateView from django.views.generic import UpdateView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from cookbook.forms import (CommentForm, ExternalRecipeForm, from cookbook.forms import CommentForm, ExternalRecipeForm, MealPlanForm, StorageForm, SyncForm
MealPlanForm, from cookbook.helper.permission_helper import GroupRequiredMixin, OwnerRequiredMixin, group_required
StorageForm, SyncForm, from cookbook.models import (Comment, MealPlan, MealType, Recipe, RecipeImport, Storage, Sync,
) UserPreference)
from cookbook.helper.permission_helper import (GroupRequiredMixin,
OwnerRequiredMixin,
group_required)
from cookbook.models import (Comment, MealPlan,
MealType, Recipe, RecipeImport,
Storage, Sync, UserPreference)
from cookbook.provider.dropbox import Dropbox from cookbook.provider.dropbox import Dropbox
from cookbook.provider.local import Local from cookbook.provider.local import Local
from cookbook.provider.nextcloud import Nextcloud from cookbook.provider.nextcloud import Nextcloud

View File

@ -1,21 +1,20 @@
import re import re
import threading import threading
from io import BytesIO from io import BytesIO
from django.core.cache import cache
from django.contrib import messages from django.contrib import messages
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import render, get_object_or_404 from django.shortcuts import get_object_or_404, render
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from cookbook.forms import ExportForm, ImportForm, ImportExportBase from cookbook.forms import ExportForm, ImportExportBase, ImportForm
from cookbook.helper.permission_helper import group_required from cookbook.helper.permission_helper import group_required
from cookbook.integration.cookbookapp import CookBookApp
from cookbook.integration.copymethat import CopyMeThat
from cookbook.integration.pepperplate import Pepperplate
from cookbook.integration.cheftap import ChefTap from cookbook.integration.cheftap import ChefTap
from cookbook.integration.chowdown import Chowdown from cookbook.integration.chowdown import Chowdown
from cookbook.integration.cookbookapp import CookBookApp
from cookbook.integration.copymethat import CopyMeThat
from cookbook.integration.default import Default from cookbook.integration.default import Default
from cookbook.integration.domestica import Domestica from cookbook.integration.domestica import Domestica
from cookbook.integration.mealie import Mealie from cookbook.integration.mealie import Mealie
@ -23,14 +22,15 @@ from cookbook.integration.mealmaster import MealMaster
from cookbook.integration.nextcloud_cookbook import NextcloudCookbook from cookbook.integration.nextcloud_cookbook import NextcloudCookbook
from cookbook.integration.openeats import OpenEats from cookbook.integration.openeats import OpenEats
from cookbook.integration.paprika import Paprika from cookbook.integration.paprika import Paprika
from cookbook.integration.pdfexport import PDFexport
from cookbook.integration.pepperplate import Pepperplate
from cookbook.integration.plantoeat import Plantoeat from cookbook.integration.plantoeat import Plantoeat
from cookbook.integration.recipekeeper import RecipeKeeper
from cookbook.integration.recettetek import RecetteTek from cookbook.integration.recettetek import RecetteTek
from cookbook.integration.recipekeeper import RecipeKeeper
from cookbook.integration.recipesage import RecipeSage from cookbook.integration.recipesage import RecipeSage
from cookbook.integration.rezkonv import RezKonv from cookbook.integration.rezkonv import RezKonv
from cookbook.integration.saffron import Saffron from cookbook.integration.saffron import Saffron
from cookbook.integration.pdfexport import PDFexport from cookbook.models import ExportLog, ImportLog, Recipe, UserPreference
from cookbook.models import Recipe, ImportLog, ExportLog, UserPreference
from recipes import settings from recipes import settings

View File

@ -5,19 +5,17 @@ from smtplib import SMTPException
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.core.mail import send_mail, BadHeaderError from django.core.mail import BadHeaderError, send_mail
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.generic import CreateView from django.views.generic import CreateView
from cookbook.forms import (ImportRecipeForm, InviteLinkForm, from cookbook.forms import ImportRecipeForm, InviteLinkForm, MealPlanForm, Storage, StorageForm
MealPlanForm, Storage, StorageForm) from cookbook.helper.permission_helper import GroupRequiredMixin, group_required
from cookbook.helper.permission_helper import (GroupRequiredMixin, from cookbook.models import (InviteLink, MealPlan, MealType, Recipe, RecipeBook, RecipeImport,
group_required) ShareLink, Step, UserPreference)
from cookbook.models import (InviteLink, MealPlan, MealType, Recipe,
RecipeBook, RecipeImport, ShareLink, Step, UserPreference)
from cookbook.views.edit import SpaceFormMixing from cookbook.views.edit import SpaceFormMixing
from recipes import settings from recipes import settings

View File

@ -8,7 +8,7 @@ from django.views.decorators.csrf import csrf_exempt
from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.ingredient_parser import IngredientParser
from cookbook.helper.permission_helper import group_required from cookbook.helper.permission_helper import group_required
from cookbook.models import TelegramBot, ShoppingList, ShoppingListEntry from cookbook.models import ShoppingList, ShoppingListEntry, TelegramBot
@group_required('user') @group_required('user')

View File

@ -12,6 +12,7 @@ from django.contrib.auth.models import Group
from django.contrib.auth.password_validation import validate_password from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db.models import Avg, Q, Sum from django.db.models import Avg, Q, Sum
from django.db.models.functions import Lower
from django.http import HttpResponseRedirect, JsonResponse from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy

View File

@ -892,7 +892,6 @@ export default {
// TODO: figure out how to find nested items and load keyword/food children for that branch // TODO: figure out how to find nested items and load keyword/food children for that branch
// probably a backend change in facets to pre-load children of nested items // probably a backend change in facets to pre-load children of nested items
for (let x of this.search.search_foods.map((x) => x.items).flat()) { for (let x of this.search.search_foods.map((x) => x.items).flat()) {
this.facets.Foods.push({ id: x, name: "loading..." }) this.facets.Foods.push({ id: x, name: "loading..." })
} }

View File

@ -110,7 +110,6 @@ export default {
}, },
saveData: function () { saveData: function () {
let apiClient = new ApiApiFactory() let apiClient = new ApiApiFactory()
console.log(this.book_copy)
apiClient apiClient
.updateRecipeBook(this.book_copy.id, this.book_copy) .updateRecipeBook(this.book_copy.id, this.book_copy)