diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/normalize/migrations/0002_auto_20191207_0922.py | 24 | ||||
-rw-r--r-- | app/normalize/models.py | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/app/normalize/migrations/0002_auto_20191207_0922.py b/app/normalize/migrations/0002_auto_20191207_0922.py new file mode 100644 index 0000000..06ee5e8 --- /dev/null +++ b/app/normalize/migrations/0002_auto_20191207_0922.py @@ -0,0 +1,24 @@ +# Generated by Django 2.2.6 on 2019-12-07 09:22 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('normalize', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='relatedpost', + options={'get_latest_by': 'pub_date', 'ordering': ('model_name', '-pub_date')}, + ), + migrations.AddField( + model_name='relatedpost', + name='pub_date', + field=models.DateTimeField(default=datetime.datetime(2019, 12, 7, 9, 22, 37, 450036), verbose_name='Date published'), + preserve_default=False, + ), + ] diff --git a/app/normalize/models.py b/app/normalize/models.py index ac36512..bcd8eac 100644 --- a/app/normalize/models.py +++ b/app/normalize/models.py @@ -7,6 +7,11 @@ class RelatedPost(models.Model): entry_id = models.IntegerField() title = models.CharField(max_length=200) slug = models.CharField(max_length=50) + pub_date = models.DateTimeField('Date published') + + class Meta: + ordering = ('model_name', '-pub_date',) + get_latest_by = 'pub_date' def __str__(self): return self.title |