mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
Merge branch 'develop' into HomeAssistantConnector
This commit is contained in:
@@ -323,8 +323,8 @@ admin.site.register(MealPlan, MealPlanAdmin)
|
||||
|
||||
|
||||
class MealTypeAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'created_by', 'order')
|
||||
search_fields = ('name', 'created_by__username')
|
||||
list_display = ('name', 'space', 'created_by', 'order')
|
||||
search_fields = ('name', 'space', 'created_by__username')
|
||||
|
||||
|
||||
admin.site.register(MealType, MealTypeAdmin)
|
||||
|
||||
@@ -12,8 +12,8 @@ msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-05-18 14:28+0200\n"
|
||||
"PO-Revision-Date: 2023-04-29 07:55+0000\n"
|
||||
"Last-Translator: Oliver Cervera <olivercervera@yahoo.it>\n"
|
||||
"PO-Revision-Date: 2024-02-01 17:22+0000\n"
|
||||
"Last-Translator: Lorenzo <gerosa.lorenzo.gl@gmail.com>\n"
|
||||
"Language-Team: Italian <http://translate.tandoor.dev/projects/tandoor/"
|
||||
"recipes-backend/it/>\n"
|
||||
"Language: it\n"
|
||||
@@ -536,27 +536,27 @@ msgstr "rotazione inversa"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:267
|
||||
msgid "careful rotation"
|
||||
msgstr ""
|
||||
msgstr "rotazione con cura"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:268
|
||||
msgid "knead"
|
||||
msgstr ""
|
||||
msgstr "impastare"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:269
|
||||
msgid "thicken"
|
||||
msgstr ""
|
||||
msgstr "addensare"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:270
|
||||
msgid "warm up"
|
||||
msgstr ""
|
||||
msgstr "riscaldare"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:271
|
||||
msgid "ferment"
|
||||
msgstr ""
|
||||
msgstr "fermentare"
|
||||
|
||||
#: .\cookbook\helper\recipe_url_import.py:272
|
||||
msgid "sous-vide"
|
||||
msgstr ""
|
||||
msgstr "sottovuoto"
|
||||
|
||||
#: .\cookbook\helper\shopping_helper.py:157
|
||||
msgid "You must supply a servings size"
|
||||
@@ -1760,6 +1760,13 @@ msgid ""
|
||||
"selected for a full text search.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
" \n"
|
||||
" Ricerche semplici ignorano la puteggiatura e parole comuni come "
|
||||
"\"il\", \"un\", \"e\". E tratterà separatamente le parole come necessario.\n"
|
||||
" Cercare \"mela o farina\" restituisce ogni ricetta che contiene "
|
||||
"sia \"mele\" che \"farina\" ovunque nei campi che sono stati selezionati per "
|
||||
"una ricerca completa di testo.\n"
|
||||
" "
|
||||
|
||||
#: .\cookbook\templates\search_info.html:34
|
||||
msgid ""
|
||||
@@ -1771,6 +1778,13 @@ msgid ""
|
||||
"been selected for a full text search.\n"
|
||||
" "
|
||||
msgstr ""
|
||||
" \n"
|
||||
" Ricerche di frase ignorano la punteggiatura, ma cercano tutte "
|
||||
"parole nell'esatto ordine indicato.\n"
|
||||
" Cercare \"mele o farina\" restituisce una ricetta che contiene "
|
||||
"l'esatta frase \"mele o farina\" in qualsiasi campo selezionato per una "
|
||||
"ricerca completa di testo.\n"
|
||||
" "
|
||||
|
||||
#: .\cookbook\templates\search_info.html:39
|
||||
msgid ""
|
||||
|
||||
25
cookbook/management/commands/seed_basic_data.py
Normal file
25
cookbook/management/commands/seed_basic_data.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.postgres.search import SearchVector
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import translation
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_scopes import scopes_disabled
|
||||
|
||||
from cookbook.managers import DICTIONARY
|
||||
from cookbook.models import Recipe, Step, Space
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Seeds some basic data (space, account, food)'
|
||||
|
||||
def handle(self, *args, **options):
|
||||
with scopes_disabled():
|
||||
user = User.objects.get_or_create(username='test')[0]
|
||||
user.set_password('test')
|
||||
user.save()
|
||||
|
||||
space = Space.objects.get_or_create(
|
||||
name='Test Space',
|
||||
created_by=user
|
||||
)[0]
|
||||
@@ -13,22 +13,22 @@ def migrate_icons(apps, schema_editor):
|
||||
PropertyType = apps.get_model('cookbook', 'PropertyType')
|
||||
RecipeBook = apps.get_model('cookbook', 'RecipeBook')
|
||||
|
||||
duplicate_meal_types = MealType.objects.values('name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
duplicate_meal_types = MealType.objects.values('space_id', 'name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
if len(duplicate_meal_types) > 0:
|
||||
raise RuntimeError(f'Duplicate MealTypes found, please remove/rename them and run migrations again/restart the container. {duplicate_meal_types}')
|
||||
MealType.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
|
||||
duplicate_meal_types = Keyword.objects.values('name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
duplicate_meal_types = Keyword.objects.values('space_id', 'name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
if len(duplicate_meal_types) > 0:
|
||||
raise RuntimeError(f'Duplicate Keyword found, please remove/rename them and run migrations again/restart the container. {duplicate_meal_types}')
|
||||
Keyword.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
|
||||
duplicate_meal_types = PropertyType.objects.values('name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
duplicate_meal_types = PropertyType.objects.values('space_id', 'name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
if len(duplicate_meal_types) > 0:
|
||||
raise RuntimeError(f'Duplicate PropertyType found, please remove/rename them and run migrations again/restart the container. {duplicate_meal_types}')
|
||||
PropertyType.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
|
||||
duplicate_meal_types = RecipeBook.objects.values('name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
duplicate_meal_types = RecipeBook.objects.values('space_id', 'name').annotate(name_count=Count('name')).exclude(name_count=1).all()
|
||||
if len(duplicate_meal_types) > 0:
|
||||
raise RuntimeError(f'Duplicate RecipeBook found, please remove/rename them and run migrations again/restart the container. {duplicate_meal_types}')
|
||||
RecipeBook.objects.update(name=Concat(F('icon'), Value(' '), F('name')))
|
||||
@@ -40,7 +40,7 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython( migrate_icons),
|
||||
migrations.RunPython(migrate_icons),
|
||||
migrations.AlterModelOptions(
|
||||
name='propertytype',
|
||||
options={'ordering': ('order',)},
|
||||
|
||||
@@ -348,7 +348,7 @@ class MealTypeSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
||||
validated_data['name'] = validated_data['name'].strip()
|
||||
space = validated_data.pop('space', self.context['request'].space)
|
||||
validated_data['created_by'] = self.context['request'].user
|
||||
obj, created = MealType.objects.get_or_create(name__iexact=validated_data['name'], space=space, defaults=validated_data)
|
||||
obj, created = MealType.objects.get_or_create(name__iexact=validated_data['name'], space=space, created_by=self.context['request'].user, defaults=validated_data)
|
||||
return obj
|
||||
|
||||
class Meta:
|
||||
|
||||
Reference in New Issue
Block a user