diff options
Diffstat (limited to 'lib/orm')
-rw-r--r-- | lib/orm/management/commands/lsupdates.py | 3 | ||||
-rwxr-xr-x | lib/orm/migrations/0002_updates.py | 19 | ||||
-rw-r--r-- | lib/orm/models.py | 5 |
3 files changed, 26 insertions, 1 deletions
diff --git a/lib/orm/management/commands/lsupdates.py b/lib/orm/management/commands/lsupdates.py index 365c8ab4..2a89a811 100644 --- a/lib/orm/management/commands/lsupdates.py +++ b/lib/orm/management/commands/lsupdates.py @@ -130,7 +130,8 @@ class Command(BaseCommand): updated_source=DataSource.objects.get(id=id) updated_source.loaded = True if update_modified: - updated_source.lastModifiedDate = datetime.today().strftime('%Y-%m-%d %H:%M:%S') + updated_source.lastModifiedDate = datetime.today().strftime(DataSource.DATETIME_FORMAT) + updated_source.lastUpdatedDate = datetime.today().strftime(DataSource.DATETIME_FORMAT) updated_source.save() def nist_cwe(self, content): diff --git a/lib/orm/migrations/0002_updates.py b/lib/orm/migrations/0002_updates.py new file mode 100755 index 00000000..44bca14b --- /dev/null +++ b/lib/orm/migrations/0002_updates.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('orm', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='datasource', + name='lastUpdatedDate', + field=models.CharField(max_length=50, blank=True), + ), + ] diff --git a/lib/orm/models.py b/lib/orm/models.py index ed6cee31..fd0fb0e9 100644 --- a/lib/orm/models.py +++ b/lib/orm/models.py @@ -151,6 +151,10 @@ class DataSource(models.Model): (ONSTARTUP, 'OnStartup'), ) + # Global date format + DATE_FORMAT = '%Y-%m-%d' + DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S' + key = models.CharField(max_length=20) data = models.CharField(max_length=20) source = models.CharField(max_length=20) @@ -164,6 +168,7 @@ class DataSource(models.Model): update_frequency = models.IntegerField(choices=FREQUENCY, default=DAILY) loaded = models.BooleanField(default=False) lastModifiedDate = models.CharField(max_length=50, blank=True) + lastUpdatedDate = models.CharField(max_length=50, blank=True) update_time = models.CharField(max_length=50, blank=True) def get_frequency_text(self): |