Commit 0dcac1d6 authored by Chris Lamb's avatar Chris Lamb 💬

Use django.utils.timezone in Django 2.x.

parent 7d19e69c
import datetime
import functools import functools
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
...@@ -25,7 +25,7 @@ class Submission(models.Model): ...@@ -25,7 +25,7 @@ class Submission(models.Model):
'keys.Key', related_name='submissions', on_delete=models.CASCADE 'keys.Key', related_name='submissions', on_delete=models.CASCADE
) )
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('created',) ordering = ('created',)
......
import datetime
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone
class Buildinfo(models.Model): class Buildinfo(models.Model):
...@@ -31,7 +30,7 @@ class Buildinfo(models.Model): ...@@ -31,7 +30,7 @@ class Buildinfo(models.Model):
environment = models.TextField() environment = models.TextField()
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('-created',) ordering = ('-created',)
...@@ -76,7 +75,7 @@ class Binary(models.Model): ...@@ -76,7 +75,7 @@ class Binary(models.Model):
on_delete=models.CASCADE, on_delete=models.CASCADE,
) )
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('binary__name',) ordering = ('binary__name',)
...@@ -108,7 +107,7 @@ class Checksum(models.Model): ...@@ -108,7 +107,7 @@ class Checksum(models.Model):
Binary, null=True, related_name='checksum', on_delete=models.CASCADE Binary, null=True, related_name='checksum', on_delete=models.CASCADE
) )
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('-created',) ordering = ('-created',)
...@@ -122,7 +121,7 @@ class Checksum(models.Model): ...@@ -122,7 +121,7 @@ class Checksum(models.Model):
class Origin(models.Model): class Origin(models.Model):
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
......
import datetime import datetime
from django.db import models, transaction from django.db import models, transaction
from django.utils import timezone
class Key(models.Model): class Key(models.Model):
...@@ -8,7 +9,7 @@ class Key(models.Model): ...@@ -8,7 +9,7 @@ class Key(models.Model):
name = models.TextField() name = models.TextField()
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('-created',) ordering = ('-created',)
......
...@@ -2,12 +2,13 @@ import datetime ...@@ -2,12 +2,13 @@ import datetime
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone
class Source(models.Model): class Source(models.Model):
name = models.CharField(max_length=200, unique=True) name = models.CharField(max_length=200, unique=True)
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
...@@ -37,7 +38,7 @@ class Binary(models.Model): ...@@ -37,7 +38,7 @@ class Binary(models.Model):
class Architecture(models.Model): class Architecture(models.Model):
name = models.CharField(max_length=200, unique=True) name = models.CharField(max_length=200, unique=True)
created = models.DateTimeField(default=datetime.datetime.utcnow) created = models.DateTimeField(default=timezone.now)
class Meta: class Meta:
ordering = ('name',) ordering = ('name',)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment