From 64fb88cc101ba6b937d8ad8dfa7049821cbf936e Mon Sep 17 00:00:00 2001 From: Joel Bradshaw Date: Wed, 25 Nov 2020 22:56:41 -0800 Subject: [PATCH] ProgressUpdate doesn't need its own date field Just use the base model's created_date --- bookwyrm/migrations/0012_progressupdate.py | 1 - bookwyrm/models/status.py | 1 - bookwyrm/templates/book.html | 2 +- bookwyrm/views.py | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bookwyrm/migrations/0012_progressupdate.py b/bookwyrm/migrations/0012_progressupdate.py index 6fec6ca5e..131419712 100644 --- a/bookwyrm/migrations/0012_progressupdate.py +++ b/bookwyrm/migrations/0012_progressupdate.py @@ -21,7 +21,6 @@ class Migration(migrations.Migration): ('remote_id', models.CharField(max_length=255, null=True)), ('progress', models.IntegerField()), ('mode', models.CharField(choices=[('PG', 'page'), ('PCT', 'percent')], default='PG', max_length=3)), - ('date', models.DateTimeField(auto_now_add=True)), ('readthrough', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='bookwyrm.ReadThrough')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), ], diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index d52a10085..934a88387 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -339,7 +339,6 @@ class ProgressUpdate(BookWyrmModel): readthrough = models.ForeignKey('ReadThrough', on_delete=models.PROTECT) progress = models.IntegerField() mode = models.CharField(max_length=3, choices=ProgressMode.choices, default=ProgressMode.PAGE) - date = models.DateTimeField(auto_now_add=True) def save(self, *args, **kwargs): ''' update user active time ''' diff --git a/bookwyrm/templates/book.html b/bookwyrm/templates/book.html index fe2691f13..2bd9fc778 100644 --- a/bookwyrm/templates/book.html +++ b/bookwyrm/templates/book.html @@ -95,7 +95,7 @@ Progress Updates:
{% for progress_update in readthrough.progress_updates %} -
{{ progress_update.date | naturalday }}:
+
{{ progress_update.created_date | naturalday }}:
{{ progress_update.progress }} of {{ book.pages }}
{% endfor %}
diff --git a/bookwyrm/views.py b/bookwyrm/views.py index 19d3af97d..5ccc343e1 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -564,7 +564,7 @@ def book_page(request, book_id): for readthrough in readthroughs: readthrough.progress_updates = \ - readthrough.progressupdate_set.all().order_by('date') + readthrough.progressupdate_set.all().order_by('updated_date') rating = reviews.aggregate(Avg('rating')) tags = models.Tag.objects.filter(