mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-04 21:58:54 -05:00
fixed search defaults
This commit is contained in:
@@ -9,8 +9,15 @@ from django.utils import translation
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from cookbook.managers import DICTIONARY
|
||||
from cookbook.models import (Index, PermissionModelMixin, Recipe, Step, allSearchFields,
|
||||
nameSearchField)
|
||||
from cookbook.models import (Index, PermissionModelMixin, Recipe, Step, SearchFields)
|
||||
|
||||
|
||||
def allSearchFields():
|
||||
return list(SearchFields.objects.values_list('id', flat=True))
|
||||
|
||||
|
||||
def nameSearchField():
|
||||
return [SearchFields.objects.get(name='Name').id]
|
||||
|
||||
|
||||
def set_default_search_vector(apps, schema_editor):
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from django.db import migrations, models
|
||||
from cookbook.models import nameSearchField
|
||||
|
||||
from cookbook.models import SearchFields
|
||||
|
||||
|
||||
def nameSearchField():
|
||||
return [SearchFields.objects.get(name='Name').id]
|
||||
|
||||
|
||||
def add_default_trigram(apps, schema_editor):
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 4.0.4 on 2022-06-14 14:48
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0175_remove_userpreference_space'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='searchpreference',
|
||||
name='icontains',
|
||||
field=models.ManyToManyField(blank=True, related_name='icontains_fields', to='cookbook.searchfields'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='searchpreference',
|
||||
name='trigram',
|
||||
field=models.ManyToManyField(blank=True, related_name='trigram_fields', to='cookbook.searchfields'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='searchpreference',
|
||||
name='unaccent',
|
||||
field=models.ManyToManyField(blank=True, related_name='unaccent_fields', to='cookbook.searchfields'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user