mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
Merge branch 'develop' into feature/vue3
This commit is contained in:
@@ -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 project and execute it.
|
||||||
COPY . ./
|
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
|
# collect information from git repositories
|
||||||
RUN /opt/recipes/venv/bin/python version.py
|
RUN /opt/recipes/venv/bin/python version.py
|
||||||
# delete git repositories to reduce image size
|
# delete git repositories to reduce image size
|
||||||
|
|||||||
21
boot.sh
21
boot.sh
@@ -67,25 +67,12 @@ echo "Migrating database"
|
|||||||
|
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
|
||||||
if [[ "${DOCKER}" == "true" ]]; then
|
echo "Collecting static files, this may take a while..."
|
||||||
if [[ -d "/opt/recipes/staticfiles-collect" ]]; then
|
|
||||||
echo "Copying cached static files from docker build"
|
|
||||||
|
|
||||||
mkdir -p /opt/recipes/staticfiles
|
python manage.py collectstatic_js_reverse
|
||||||
rm -rf /opt/recipes/staticfiles/*
|
python manage.py collectstatic --noinput
|
||||||
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
|
echo "Done"
|
||||||
python manage.py collectstatic --noinput
|
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod -R 755 /opt/recipes/mediafiles
|
chmod -R 755 /opt/recipes/mediafiles
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
]
|
||||||
@@ -1141,6 +1141,7 @@ class MealType(models.Model, PermissionModelMixin):
|
|||||||
name = models.CharField(max_length=128)
|
name = models.CharField(max_length=128)
|
||||||
order = models.IntegerField(default=0)
|
order = models.IntegerField(default=0)
|
||||||
color = models.CharField(max_length=7, blank=True, null=True)
|
color = models.CharField(max_length=7, blank=True, null=True)
|
||||||
|
time = models.TimeField(null=True, blank=True)
|
||||||
default = models.BooleanField(default=False, blank=True)
|
default = models.BooleanField(default=False, blank=True)
|
||||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
|
||||||
@@ -1164,8 +1165,8 @@ class MealPlan(ExportModelOperationsMixin('meal_plan'), models.Model, Permission
|
|||||||
shared = models.ManyToManyField(User, blank=True, related_name='plan_share')
|
shared = models.ManyToManyField(User, blank=True, related_name='plan_share')
|
||||||
meal_type = models.ForeignKey(MealType, on_delete=models.CASCADE)
|
meal_type = models.ForeignKey(MealType, on_delete=models.CASCADE)
|
||||||
note = models.TextField(blank=True)
|
note = models.TextField(blank=True)
|
||||||
from_date = models.DateField()
|
from_date = models.DateTimeField()
|
||||||
to_date = models.DateField()
|
to_date = models.DateTimeField()
|
||||||
|
|
||||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
||||||
objects = ScopedManager(space='space')
|
objects = ScopedManager(space='space')
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ class MealTypeSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
list_serializer_class = SpaceFilterSerializer
|
list_serializer_class = SpaceFilterSerializer
|
||||||
model = MealType
|
model = MealType
|
||||||
fields = ('id', 'name', 'order', 'color', 'default', 'created_by')
|
fields = ('id', 'name', 'order', 'time', 'color', 'default', 'created_by')
|
||||||
read_only_fields = ('created_by',)
|
read_only_fields = ('created_by',)
|
||||||
|
|
||||||
|
|
||||||
@@ -1099,7 +1099,7 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
|||||||
shared = UserSerializer(many=True, required=False, allow_null=True)
|
shared = UserSerializer(many=True, required=False, allow_null=True)
|
||||||
shopping = serializers.SerializerMethodField('in_shopping')
|
shopping = serializers.SerializerMethodField('in_shopping')
|
||||||
|
|
||||||
to_date = serializers.DateField(required=False)
|
to_date = serializers.DateTimeField(required=False)
|
||||||
|
|
||||||
@extend_schema_field(str)
|
@extend_schema_field(str)
|
||||||
def get_note_markdown(self, obj):
|
def get_note_markdown(self, obj):
|
||||||
|
|||||||
@@ -544,5 +544,13 @@
|
|||||||
"Logo": "Logo",
|
"Logo": "Logo",
|
||||||
"Show_Logo": "Montrer le logo",
|
"Show_Logo": "Montrer le logo",
|
||||||
"Shopping_input_placeholder": "par ex. Pommes de terre/100 Pommes de terre/100 gr Pomme de terre",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user