Fixes mistake in parent model definition

This commit is contained in:
Mouse Reeve 2020-02-20 17:33:50 -08:00
parent 4309a70c5e
commit 9c645c6ab6
4 changed files with 97 additions and 1 deletions

View file

@ -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),
),
]

View file

@ -10,6 +10,7 @@ class Status(FedireadsModel):
''' any post, like a reply to a review, etc ''' ''' any post, like a reply to a review, etc '''
user = models.ForeignKey('User', on_delete=models.PROTECT) user = models.ForeignKey('User', on_delete=models.PROTECT)
status_type = models.CharField(max_length=255, default='Note') 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_users = models.ManyToManyField('User', related_name='mention_user')
mention_books = models.ManyToManyField('Book', related_name='mention_book') mention_books = models.ManyToManyField('Book', related_name='mention_book')
activity_type = models.CharField(max_length=255, default='Note') activity_type = models.CharField(max_length=255, default='Note')

View file

@ -47,6 +47,8 @@ class User(AbstractUser):
through_fields=('user', 'status'), through_fields=('user', 'status'),
related_name='favorite_statuses' related_name='favorite_statuses'
) )
created_date = models.DateTimeField(auto_now_add=True)
updated_date = models.DateTimeField(auto_now=True)
@property @property
def absolute_id(self): def absolute_id(self):

View file

@ -4,8 +4,8 @@ from fedireads.settings import DOMAIN
class FedireadsModel(models.Model): class FedireadsModel(models.Model):
content = models.TextField(blank=True, null=True)
created_date = models.DateTimeField(auto_now_add=True) created_date = models.DateTimeField(auto_now_add=True)
updated_date = models.DateTimeField(auto_now=True)
@property @property
def absolute_id(self): def absolute_id(self):