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

View file

@ -21,7 +21,6 @@ class Migration(migrations.Migration):
('remote_id', models.CharField(max_length=255, null=True)), ('remote_id', models.CharField(max_length=255, null=True)),
('progress', models.IntegerField()), ('progress', models.IntegerField()),
('mode', models.CharField(choices=[('PG', 'page'), ('PCT', 'percent')], default='PG', max_length=3)), ('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')), ('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)), ('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) readthrough = models.ForeignKey('ReadThrough', on_delete=models.PROTECT)
progress = models.IntegerField() progress = models.IntegerField()
mode = models.CharField(max_length=3, choices=ProgressMode.choices, default=ProgressMode.PAGE) mode = models.CharField(max_length=3, choices=ProgressMode.choices, default=ProgressMode.PAGE)
date = models.DateTimeField(auto_now_add=True)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
''' update user active time ''' ''' update user active time '''

View file

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

View file

@ -564,7 +564,7 @@ def book_page(request, book_id):
for readthrough in readthroughs: for readthrough in readthroughs:
readthrough.progress_updates = \ readthrough.progress_updates = \
readthrough.progressupdate_set.all().order_by('date') readthrough.progressupdate_set.all().order_by('updated_date')
rating = reviews.aggregate(Avg('rating')) rating = reviews.aggregate(Avg('rating'))
tags = models.Tag.objects.filter( tags = models.Tag.objects.filter(