diff options
Diffstat (limited to 'lib')
-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 | ||||
-rw-r--r-- | lib/srtgui/tables.py | 17 | ||||
-rw-r--r-- | lib/srtgui/templates/management.html | 2 |
5 files changed, 40 insertions, 6 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): diff --git a/lib/srtgui/tables.py b/lib/srtgui/tables.py index 09446fae..4da603b9 100644 --- a/lib/srtgui/tables.py +++ b/lib/srtgui/tables.py @@ -1667,12 +1667,21 @@ class SourcesTable(ToasterTable): ) self.add_column(title="Data Modified", + help_text="Last upstream date", hideable=False, orderable=True, field_name="lastModifiedDate", ) - self.add_column(title="Updates", + self.add_column(title="Updated", + help_text="Last update date", + hideable=True, + hidden=True, + #orderable=True, + field_name="lastUpdatedDate", + ) + + self.add_column(title="Update Freq.", hideable=False, orderable=True, field_name="update_frequency", @@ -1680,9 +1689,9 @@ class SourcesTable(ToasterTable): static_data_template="{{data.get_frequency_text}}", ) - self.add_column(title="Updated", - hideable=False, - orderable=True, + self.add_column(title="Update Detail", + hideable=True, + hidden=True, field_name="update_time", ) diff --git a/lib/srtgui/templates/management.html b/lib/srtgui/templates/management.html index 558b7a22..fe40ecb3 100644 --- a/lib/srtgui/templates/management.html +++ b/lib/srtgui/templates/management.html @@ -51,7 +51,7 @@ </tr> <tr> - <td><a class="btn btn-info btn-lg" href="{% url 'sources' %}">Manage Sources</a></td> + <td><a class="btn btn-info btn-lg" href="{% url 'sources' %}?nocache=1">Manage Sources</a></td> <td>Manage source list, perform manual pulls</td> </tr> {% endif %} |