diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 0c3b19ba..1edc5d5c 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -29,6 +29,7 @@ class CustomForm(ModelForm): visible.field.widget.attrs['rows'] = None visible.field.widget.attrs['class'] = css_classes[input_type] + class LoginForm(CustomForm): class Meta: model = models.User @@ -158,3 +159,9 @@ class CreateInviteForm(CustomForm): choices=[(i, "%d uses" % (i,)) for i in [1, 5, 10, 25, 50, 100]] + [(None, 'Unlimited')]) } + + +class ReadThroughForm(CustomForm): + class Meta: + model = models.ReadThrough + fields = ['user', 'book', 'start_date', 'finish_date'] diff --git a/bookwyrm/templates/book.html b/bookwyrm/templates/book.html index c5d529ed..8b169600 100644 --- a/bookwyrm/templates/book.html +++ b/bookwyrm/templates/book.html @@ -56,10 +56,60 @@ {% for readthrough in readthroughs %} -
- {{ readthrough.start_date }} - {{ readthrough.finish_date }} - {{ readthrough.pages_read }} +
+ + +
+ +
+ +
{% endfor %} diff --git a/bookwyrm/views.py b/bookwyrm/views.py index b1bb25f4..67586a22 100644 --- a/bookwyrm/views.py +++ b/bookwyrm/views.py @@ -493,7 +493,6 @@ def book_page(request, book_id): book=book, ).order_by('start_date') - rating = reviews.aggregate(Avg('rating')) tags = models.Tag.objects.filter( book=book @@ -508,10 +507,10 @@ def book_page(request, book_id): 'rating': rating['rating__avg'], 'tags': tags, 'user_tags': user_tags, - 'readthroughs': readthroughs, 'review_form': forms.ReviewForm(), 'quotation_form': forms.QuotationForm(), 'comment_form': forms.CommentForm(), + 'readthroughs': readthroughs, 'tag_form': forms.TagForm(), 'path': '/book/%s' % book_id, 'cover_form': forms.CoverForm(instance=book),