summaryrefslogtreecommitdiff
path: root/releng/models.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-29 10:52:30 -0500
committerDan McGee <dan@archlinux.org>2011-07-05 09:44:45 -0500
commit5e85c5ac9ed09551d65ec07767094770d248f3b1 (patch)
tree8efdc0c1231617427727fc1291b8c8cda7dafd97 /releng/models.py
parent33b9bf44aac4b70fa4cc6e9d1e82fb556b836801 (diff)
Move set_created_field() to shared utils class
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'releng/models.py')
-rw-r--r--releng/models.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/releng/models.py b/releng/models.py
index 07ede1c5..5510db6a 100644
--- a/releng/models.py
+++ b/releng/models.py
@@ -1,6 +1,7 @@
-from datetime import datetime
-
from django.db import models
+from django.db.models.signals import pre_save
+
+from main.utils import set_created_field
class IsoOption(models.Model):
name = models.CharField(max_length=200)
@@ -104,14 +105,6 @@ class Test(models.Model):
success = models.BooleanField()
comments = models.TextField(null=True, blank=True)
-def set_created_field(sender, **kwargs):
- # We use this same callback for both Isos and Tests
- obj = kwargs['instance']
- if not obj.created:
- obj.created = datetime.utcnow()
-
-from django.db.models.signals import pre_save
-
pre_save.connect(set_created_field, sender=Iso,
dispatch_uid="releng.models")
pre_save.connect(set_created_field, sender=Test,