mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
minor cleanup
This commit is contained in:
@@ -127,7 +127,7 @@ def search_recipes(request, queryset, params):
|
|||||||
# TODO creating setting to include descendants of keywords a setting
|
# TODO creating setting to include descendants of keywords a setting
|
||||||
if search_keywords_or == 'true':
|
if search_keywords_or == 'true':
|
||||||
# when performing an 'or' search all descendants are included in the OR condition
|
# when performing an 'or' search all descendants are included in the OR condition
|
||||||
# so descendants are appended to
|
# so descendants are appended to filter all at once
|
||||||
for kw in Keyword.objects.filter(pk__in=search_keywords):
|
for kw in Keyword.objects.filter(pk__in=search_keywords):
|
||||||
search_keywords += list(kw.get_descendants().values_list('pk', flat=True))
|
search_keywords += list(kw.get_descendants().values_list('pk', flat=True))
|
||||||
queryset = queryset.filter(keywords__id__in=search_keywords)
|
queryset = queryset.filter(keywords__id__in=search_keywords)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ def text_scraper(text, url=None):
|
|||||||
url=None
|
url=None
|
||||||
):
|
):
|
||||||
self.wild_mode = False
|
self.wild_mode = False
|
||||||
# self.exception_handling = None # TODO add new method here, old one was deprecated
|
|
||||||
self.meta_http_equiv = False
|
self.meta_http_equiv = False
|
||||||
self.soup = BeautifulSoup(page_data, "html.parser")
|
self.soup = BeautifulSoup(page_data, "html.parser")
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ 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
|
||||||
|
|
||||||
# TODO move this somewhere else and delete this file
|
|
||||||
DICTIONARY = {
|
DICTIONARY = {
|
||||||
# TODO find custom dictionaries - maybe from here https://www.postgresql.org/message-id/CAF4Au4x6X_wSXFwsQYE8q5o0aQZANrvYjZJ8uOnsiHDnOVPPEg%40mail.gmail.com
|
# TODO find custom dictionaries - maybe from here https://www.postgresql.org/message-id/CAF4Au4x6X_wSXFwsQYE8q5o0aQZANrvYjZJ8uOnsiHDnOVPPEg%40mail.gmail.com
|
||||||
# 'hy': 'Armenian',
|
# 'hy': 'Armenian',
|
||||||
@@ -22,8 +21,6 @@ DICTIONARY = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# TODO add search highlighting
|
|
||||||
# TODO add language support
|
|
||||||
# TODO add schedule index rebuild
|
# TODO add schedule index rebuild
|
||||||
class RecipeSearchManager(models.Manager):
|
class RecipeSearchManager(models.Manager):
|
||||||
def search(self, search_text, space):
|
def search(self, search_text, space):
|
||||||
|
|||||||
@@ -228,8 +228,9 @@ class SupermarketCategory(models.Model, PermissionModelMixin):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
|
constraints = [
|
||||||
unique_together = (('space', 'name'),)
|
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Supermarket(models.Model, PermissionModelMixin):
|
class Supermarket(models.Model, PermissionModelMixin):
|
||||||
@@ -244,8 +245,9 @@ class Supermarket(models.Model, PermissionModelMixin):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
|
constraints = [
|
||||||
unique_together = (('space', 'name'),)
|
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class SupermarketCategoryRelation(models.Model, PermissionModelMixin):
|
class SupermarketCategoryRelation(models.Model, PermissionModelMixin):
|
||||||
@@ -359,8 +361,9 @@ class Unit(ExportModelOperationsMixin('unit'), models.Model, PermissionModelMixi
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
|
constraints = [
|
||||||
unique_together = (('space', 'name'),)
|
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Food(ExportModelOperationsMixin('food'), models.Model, PermissionModelMixin):
|
class Food(ExportModelOperationsMixin('food'), models.Model, PermissionModelMixin):
|
||||||
@@ -377,8 +380,9 @@ class Food(ExportModelOperationsMixin('food'), models.Model, PermissionModelMixi
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
|
constraints = [
|
||||||
unique_together = (('space', 'name'),)
|
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
|
||||||
|
]
|
||||||
indexes = (Index(fields=['id', 'name']),)
|
indexes = (Index(fields=['id', 'name']),)
|
||||||
|
|
||||||
|
|
||||||
@@ -562,8 +566,9 @@ class RecipeBookEntry(ExportModelOperationsMixin('book_entry'), models.Model, Pe
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
|
constraints = [
|
||||||
unique_together = (('recipe', 'book'),)
|
models.UniqueConstraint(fields=['recipe', 'book'], name='unique_name_per_space')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class MealType(models.Model, PermissionModelMixin):
|
class MealType(models.Model, PermissionModelMixin):
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class RecipeSchema(AutoSchema):
|
|||||||
return parameters
|
return parameters
|
||||||
|
|
||||||
|
|
||||||
# TODO move to separate class to cleanup
|
|
||||||
class TreeSchema(AutoSchema):
|
class TreeSchema(AutoSchema):
|
||||||
|
|
||||||
def get_path_parameters(self, path, method):
|
def get_path_parameters(self, path, method):
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-8 col-12">
|
<div class="col-xl-8 col-12">
|
||||||
<!-- TODO only show scollbars in split mode, but this doesn't interact well with infinite scroll, maybe a different componenet? -->
|
<!-- TODO only show scollbars in split mode, but this doesn't interact well with infinite scroll, maybe a different component? -->
|
||||||
<div class="container-fluid d-flex flex-column flex-grow-1" :class="{'vh-100' : show_split}">
|
<div class="container-fluid d-flex flex-column flex-grow-1" :class="{'vh-100' : show_split}">
|
||||||
<!-- <div class="container-fluid d-flex flex-column flex-grow-1 vh-100"> -->
|
<!-- <div class="container-fluid d-flex flex-column flex-grow-1 vh-100"> -->
|
||||||
<!-- expanded options box -->
|
<!-- expanded options box -->
|
||||||
|
|||||||
Reference in New Issue
Block a user