diff options
-rw-r--r-- | api/migrations/0026_use_proper_default_for_infraction_insertion_date.py | 19 | ||||
-rw-r--r-- | api/models.py | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py b/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py new file mode 100644 index 00000000..56f3b2b8 --- /dev/null +++ b/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.5 on 2019-01-09 19:50 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0025_allow_custom_inserted_at_infraction_field'), + ] + + operations = [ + migrations.AlterField( + model_name='infraction', + name='inserted_at', + field=models.DateTimeField(default=django.utils.timezone.now, help_text='The date and time of the creation of this infraction.'), + ), + ] diff --git a/api/models.py b/api/models.py index 176b7c46..092c2e8e 100644 --- a/api/models.py +++ b/api/models.py @@ -1,9 +1,9 @@ -import datetime from operator import itemgetter from django.contrib.postgres import fields as pgfields from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator from django.db import models +from django.utils import timezone from .validators import validate_tag_embed @@ -250,7 +250,7 @@ class Infraction(ModelReprMixin, models.Model): ("superstar", "Superstar") ) inserted_at = models.DateTimeField( - default=datetime.datetime.utcnow, + default=timezone.now, help_text="The date and time of the creation of this infraction." ) expires_at = models.DateTimeField( |