diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-01-17 05:03:58 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-01-17 05:03:58 +0000 |
commit | e3a139bc58f5ece2bd56f36134243a0f151ba79b (patch) | |
tree | 71e297e60953739f0ea615de9216c786a7b71ba1 /rpkid/rpki | |
parent | f5933b44df77df3818a38474d44ea5513249d9a8 (diff) |
add support for importing mrt format ribs
remove default=0 value for timestamps, as that is not a valid initial
value for a datetime object.
since there is no default argument, the call to the Timestamp
constructor needs to specify the value.
svn path=/branches/tk161/; revision=4177
Diffstat (limited to 'rpkid/rpki')
-rw-r--r-- | rpkid/rpki/gui/app/models.py | 2 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/timestamp.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/rpkid/rpki/gui/app/models.py b/rpkid/rpki/gui/app/models.py index f81526e8..b3333986 100644 --- a/rpkid/rpki/gui/app/models.py +++ b/rpkid/rpki/gui/app/models.py @@ -261,7 +261,7 @@ class Timestamp(models.Model): set timestamps rather than updating this model directly.""" name = models.CharField(max_length=30, primary_key=True) - ts = models.DateTimeField(null=False, default=0) + ts = models.DateTimeField(null=False) def __unicode__(self): return '%s: %s' % (self.name, self.ts) diff --git a/rpkid/rpki/gui/app/timestamp.py b/rpkid/rpki/gui/app/timestamp.py index 93f1d032..959f2025 100644 --- a/rpkid/rpki/gui/app/timestamp.py +++ b/rpkid/rpki/gui/app/timestamp.py @@ -19,6 +19,7 @@ from datetime import datetime def update(name): "Set the timestamp value for the given name to the current time." - obj, created = models.Timestamp.objects.get_or_create(name=name) + q = models.Timestamp.objects.filter(name=name) + obj = q[0] if q else models.Timestamp(name=name) obj.ts = datetime.utcnow() obj.save() |