ProgressUpdate doesn't need its own date field

Just use the base model's created_date
This commit is contained in:
Joel Bradshaw 2020-11-25 22:56:41 -08:00
parent 090cf2aea7
commit 64fb88cc10
4 changed files with 2 additions and 4 deletions
bookwyrm

View file

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

View file

@ -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 '''

View file

@ -95,7 +95,7 @@
Progress Updates:
<dl class="progress-updates">
{% for progress_update in readthrough.progress_updates %}
<dt>{{ progress_update.date | naturalday }}:</dt>
<dt>{{ progress_update.created_date | naturalday }}:</dt>
<dd>{{ progress_update.progress }} of {{ book.pages }}</dd>
{% endfor %}
</dl>

View file

@ -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(