From 9c645c6ab6d3c2a2c268fc904a8361d0993caefc Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 20 Feb 2020 17:33:50 -0800 Subject: [PATCH] Fixes mistake in parent model definition --- .../migrations/0003_auto_20200221_0131.py | 93 +++++++++++++++++++ fedireads/models/activity.py | 1 + fedireads/models/user.py | 2 + fedireads/utils/models.py | 2 +- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 fedireads/migrations/0003_auto_20200221_0131.py diff --git a/fedireads/migrations/0003_auto_20200221_0131.py b/fedireads/migrations/0003_auto_20200221_0131.py new file mode 100644 index 00000000..3345f0ae --- /dev/null +++ b/fedireads/migrations/0003_auto_20200221_0131.py @@ -0,0 +1,93 @@ +# Generated by Django 3.0.3 on 2020-02-21 01:31 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('fedireads', '0002_auto_20200219_0816'), + ] + + operations = [ + migrations.RemoveField( + model_name='author', + name='content', + ), + migrations.RemoveField( + model_name='book', + name='content', + ), + migrations.RemoveField( + model_name='favorite', + name='content', + ), + migrations.RemoveField( + model_name='federatedserver', + name='content', + ), + migrations.RemoveField( + model_name='shelf', + name='content', + ), + migrations.RemoveField( + model_name='shelfbook', + name='content', + ), + migrations.RemoveField( + model_name='userrelationship', + name='content', + ), + migrations.AddField( + model_name='author', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='book', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='favorite', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='federatedserver', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='shelf', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='shelfbook', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='status', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='user', + name='created_date', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='user', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='userrelationship', + name='updated_date', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/fedireads/models/activity.py b/fedireads/models/activity.py index 1977e46b..58789dc5 100644 --- a/fedireads/models/activity.py +++ b/fedireads/models/activity.py @@ -10,6 +10,7 @@ class Status(FedireadsModel): ''' any post, like a reply to a review, etc ''' user = models.ForeignKey('User', on_delete=models.PROTECT) status_type = models.CharField(max_length=255, default='Note') + content = models.TextField(blank=True, null=True) mention_users = models.ManyToManyField('User', related_name='mention_user') mention_books = models.ManyToManyField('Book', related_name='mention_book') activity_type = models.CharField(max_length=255, default='Note') diff --git a/fedireads/models/user.py b/fedireads/models/user.py index 6f277f9a..5cab14ec 100644 --- a/fedireads/models/user.py +++ b/fedireads/models/user.py @@ -47,6 +47,8 @@ class User(AbstractUser): through_fields=('user', 'status'), related_name='favorite_statuses' ) + created_date = models.DateTimeField(auto_now_add=True) + updated_date = models.DateTimeField(auto_now=True) @property def absolute_id(self): diff --git a/fedireads/utils/models.py b/fedireads/utils/models.py index eb002986..10a86aaf 100644 --- a/fedireads/utils/models.py +++ b/fedireads/utils/models.py @@ -4,8 +4,8 @@ from fedireads.settings import DOMAIN class FedireadsModel(models.Model): - content = models.TextField(blank=True, null=True) created_date = models.DateTimeField(auto_now_add=True) + updated_date = models.DateTimeField(auto_now=True) @property def absolute_id(self):