Change measurement entry default to be timezone-aware

This commit is contained in:
Roland Geider
2026-04-24 10:26:57 +02:00
parent ac04518ddb
commit bd0bcd9134
2 changed files with 20 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
"""This only changes de default"""
dependencies = [
('measurements', '0006_change_measurement_pk_to_uuid'),
]
operations = [
migrations.AlterField(
model_name='measurement',
name='date',
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date'),
),
]

View File

@@ -12,11 +12,6 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.
# Standard Library
# Standard Library
import datetime
import uuid
# Django
from django.core.validators import (
@@ -24,6 +19,7 @@ from django.core.validators import (
MinValueValidator,
)
from django.db import models
from django.utils import timezone
# wger
from wger.measurements.models import Category
@@ -52,7 +48,7 @@ class Measurement(models.Model):
date = models.DateTimeField(
verbose_name='Date',
default=datetime.datetime.now,
default=timezone.now,
)
value = models.DecimalField(