From 1d58f318caac06fab06d3290d507a3b2e06e3cb2 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 30 Apr 2024 07:21:30 -0500 Subject: [PATCH 1/3] removing pre-cached staticfiles from Docker & boot.sh --- Dockerfile | 6 ------ boot.sh | 21 ++++----------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5856bcfa..4b52f246d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,12 +35,6 @@ RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-de #Copy project and execute it. COPY . ./ -# collect the static files -RUN /opt/recipes/venv/bin/python manage.py collectstatic_js_reverse -RUN /opt/recipes/venv/bin/python manage.py collectstatic --noinput -# copy the collected static files to a different location, so they can be moved into a potentially mounted volume -RUN mv /opt/recipes/staticfiles /opt/recipes/staticfiles-collect - # collect information from git repositories RUN /opt/recipes/venv/bin/python version.py # delete git repositories to reduce image size diff --git a/boot.sh b/boot.sh index c14d66aab..9f70a535c 100644 --- a/boot.sh +++ b/boot.sh @@ -67,25 +67,12 @@ echo "Migrating database" python manage.py migrate -if [[ "${DOCKER}" == "true" ]]; then - if [[ -d "/opt/recipes/staticfiles-collect" ]]; then - echo "Copying cached static files from docker build" +echo "Collecting static files, this may take a while..." - mkdir -p /opt/recipes/staticfiles - rm -rf /opt/recipes/staticfiles/* - mv /opt/recipes/staticfiles-collect/* /opt/recipes/staticfiles - rm -rf /opt/recipes/staticfiles-collect - else - echo "Static files are already up to date" - fi -else - echo "Collecting static files, this may take a while..." +python manage.py collectstatic_js_reverse +python manage.py collectstatic --noinput - python manage.py collectstatic_js_reverse - python manage.py collectstatic --noinput - - echo "Done" -fi +echo "Done" chmod -R 755 /opt/recipes/mediafiles From 353b2d6d21eacf704b25b56c829addf549399f44 Mon Sep 17 00:00:00 2001 From: Fymyte Date: Tue, 30 Apr 2024 13:31:27 +0000 Subject: [PATCH 2/3] Translated using Weblate (French) Currently translated at 96.8% (551 of 569 strings) Translation: Tandoor/Recipes Frontend Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/fr/ --- vue/src/locales/fr.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vue/src/locales/fr.json b/vue/src/locales/fr.json index 90370360c..da3e528df 100644 --- a/vue/src/locales/fr.json +++ b/vue/src/locales/fr.json @@ -544,5 +544,13 @@ "Logo": "Logo", "Show_Logo": "Montrer le logo", "Shopping_input_placeholder": "par ex. Pommes de terre/100 Pommes de terre/100 gr Pomme de terre", - "Sticky_Nav": "Barre de navigation collante" + "Sticky_Nav": "Barre de navigation collante", + "tbsp": "", + "DefaultPage": "Page par défaut", + "InheritFields_help": "Les valeurs de ces champs seront héritées du parent (Exception : les listes de course vide ne sont pas héritées)", + "Show_Logo_Help": "Afficher le logo Tandoor ou de groupe dans la barre de navigation.", + "Space_Cosmetic_Settings": "Certains paramètres cosmétiques peuvent être modifiés par un administrateur de l'espace et seront prioritaires sur les paramètres des utilisateurs pour cet espace.", + "Nav_Text_Mode": "Mode de navigation texte", + "Nav_Text_Mode_Help": "Se comporte différemment pour chaque thème.", + "Enable": "Activer" } From 4b551c595a6de3f433f598bda72bfe11b495d268 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 1 May 2024 13:45:12 +0200 Subject: [PATCH 3/3] MealPlan from/to date to datetime, added time to MealType --- ...alplan_from_date_alter_mealplan_to_date.py | 46 +++++++++++++++++++ cookbook/models.py | 6 +-- cookbook/serializer.py | 4 +- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 cookbook/migrations/0218_alter_mealplan_from_date_alter_mealplan_to_date.py diff --git a/cookbook/migrations/0218_alter_mealplan_from_date_alter_mealplan_to_date.py b/cookbook/migrations/0218_alter_mealplan_from_date_alter_mealplan_to_date.py new file mode 100644 index 000000000..0ab365525 --- /dev/null +++ b/cookbook/migrations/0218_alter_mealplan_from_date_alter_mealplan_to_date.py @@ -0,0 +1,46 @@ +# Generated by Django 4.2.11 on 2024-05-01 10:56 +from datetime import timedelta + +from django.db import migrations, models +from django_scopes import scopes_disabled + + +def timezone_correction(apps, schema_editor): + # when converting from date to datetime the field becomes timezone aware and defaults to 00:00:00 UTC + # this will be converted to a local datetime on the client which, for all negative offset timezones, + # would mean that the plan item shows one day prior to the previous planning date + # by setting the time on the old entries to 11:00 this issue will be limited to a very small number of people (see https://en.wikipedia.org/wiki/Time_zone#/media/File:World_Time_Zones_Map.svg) + # the server timezone could be used to guess zone of most of the clients but that would also not be perfect so this much simpler alternative is chosen + with scopes_disabled(): + MealPlan = apps.get_model('cookbook', 'MealPlan') + meal_plans = MealPlan.objects.all() + for mp in meal_plans: + mp.from_date += timedelta(hours=12) + mp.to_date += timedelta(hours=12) + + MealPlan.objects.bulk_update(meal_plans, ['from_date', 'to_date'], batch_size=1000) + + +class Migration(migrations.Migration): + dependencies = [ + ('cookbook', '0217_alter_userpreference_default_page'), + ] + + operations = [ + migrations.AddField( + model_name='mealtype', + name='time', + field=models.TimeField(blank=True, null=True), + ), + migrations.AlterField( + model_name='mealplan', + name='from_date', + field=models.DateTimeField(), + ), + migrations.AlterField( + model_name='mealplan', + name='to_date', + field=models.DateTimeField(), + ), + migrations.RunPython(timezone_correction) + ] diff --git a/cookbook/models.py b/cookbook/models.py index d2e160b8d..6c34d8183 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -417,7 +417,6 @@ class ConnectorConfig(models.Model, PermissionModelMixin): objects = ScopedManager(space='space') - class UserPreference(models.Model, PermissionModelMixin): # Themes BOOTSTRAP = 'BOOTSTRAP' @@ -1135,6 +1134,7 @@ class MealType(models.Model, PermissionModelMixin): name = models.CharField(max_length=128) order = models.IntegerField(default=0) color = models.CharField(max_length=7, blank=True, null=True) + time = models.TimeField(null=True, blank=True) default = models.BooleanField(default=False, blank=True) created_by = models.ForeignKey(User, on_delete=models.CASCADE) @@ -1158,8 +1158,8 @@ class MealPlan(ExportModelOperationsMixin('meal_plan'), models.Model, Permission shared = models.ManyToManyField(User, blank=True, related_name='plan_share') meal_type = models.ForeignKey(MealType, on_delete=models.CASCADE) note = models.TextField(blank=True) - from_date = models.DateField() - to_date = models.DateField() + from_date = models.DateTimeField() + to_date = models.DateTimeField() space = models.ForeignKey(Space, on_delete=models.CASCADE) objects = ScopedManager(space='space') diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 816180ba7..8a7114c46 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -355,7 +355,7 @@ class MealTypeSerializer(SpacedModelSerializer, WritableNestedModelSerializer): class Meta: list_serializer_class = SpaceFilterSerializer model = MealType - fields = ('id', 'name', 'order', 'color', 'default', 'created_by') + fields = ('id', 'name', 'order', 'time', 'color', 'default', 'created_by') read_only_fields = ('created_by',) @@ -1030,7 +1030,7 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer): shared = UserSerializer(many=True, required=False, allow_null=True) shopping = serializers.SerializerMethodField('in_shopping') - to_date = serializers.DateField(required=False) + to_date = serializers.DateTimeField(required=False) def get_note_markdown(self, obj): return markdown(obj.note)