minor cleanup

This commit is contained in:
smilerz
2021-08-13 11:23:47 -05:00
parent 170673f467
commit 5d8ebc513a
6 changed files with 17 additions and 17 deletions

View File

@ -127,7 +127,7 @@ def search_recipes(request, queryset, params):
# TODO creating setting to include descendants of keywords a setting
if search_keywords_or == 'true':
# 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):
search_keywords += list(kw.get_descendants().values_list('pk', flat=True))
queryset = queryset.filter(keywords__id__in=search_keywords)

View File

@ -30,7 +30,6 @@ def text_scraper(text, url=None):
url=None
):
self.wild_mode = False
# self.exception_handling = None # TODO add new method here, old one was deprecated
self.meta_http_equiv = False
self.soup = BeautifulSoup(page_data, "html.parser")
self.url = url

View File

@ -6,7 +6,6 @@ from django.db import models
from django.db.models import Q
from django.utils import translation
# TODO move this somewhere else and delete this file
DICTIONARY = {
# TODO find custom dictionaries - maybe from here https://www.postgresql.org/message-id/CAF4Au4x6X_wSXFwsQYE8q5o0aQZANrvYjZJ8uOnsiHDnOVPPEg%40mail.gmail.com
# 'hy': 'Armenian',
@ -22,8 +21,6 @@ DICTIONARY = {
}
# TODO add search highlighting
# TODO add language support
# TODO add schedule index rebuild
class RecipeSearchManager(models.Manager):
def search(self, search_text, space):

View File

@ -228,8 +228,9 @@ class SupermarketCategory(models.Model, PermissionModelMixin):
return self.name
class Meta:
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
unique_together = (('space', 'name'),)
constraints = [
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
]
class Supermarket(models.Model, PermissionModelMixin):
@ -244,8 +245,9 @@ class Supermarket(models.Model, PermissionModelMixin):
return self.name
class Meta:
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
unique_together = (('space', 'name'),)
constraints = [
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
]
class SupermarketCategoryRelation(models.Model, PermissionModelMixin):
@ -359,8 +361,9 @@ class Unit(ExportModelOperationsMixin('unit'), models.Model, PermissionModelMixi
return self.name
class Meta:
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
unique_together = (('space', 'name'),)
constraints = [
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
]
class Food(ExportModelOperationsMixin('food'), models.Model, PermissionModelMixin):
@ -377,8 +380,9 @@ class Food(ExportModelOperationsMixin('food'), models.Model, PermissionModelMixi
return self.name
class Meta:
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
unique_together = (('space', 'name'),)
constraints = [
models.UniqueConstraint(fields=['space', 'name'], name='unique_name_per_space')
]
indexes = (Index(fields=['id', 'name']),)
@ -562,8 +566,9 @@ class RecipeBookEntry(ExportModelOperationsMixin('book_entry'), models.Model, Pe
return None
class Meta:
# TODO according to this https://docs.djangoproject.com/en/3.1/ref/models/options/#unique-together should not be used
unique_together = (('recipe', 'book'),)
constraints = [
models.UniqueConstraint(fields=['recipe', 'book'], name='unique_name_per_space')
]
class MealType(models.Model, PermissionModelMixin):

View File

@ -62,7 +62,6 @@ class RecipeSchema(AutoSchema):
return parameters
# TODO move to separate class to cleanup
class TreeSchema(AutoSchema):
def get_path_parameters(self, path, method):

View File

@ -6,7 +6,7 @@
</div>
<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 vh-100"> -->
<!-- expanded options box -->