mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-06 23:35:28 +00:00
Create comments when commentary is provided
This commit is contained in:
parent
f12c5df288
commit
6280671d92
2 changed files with 13 additions and 3 deletions
|
@ -11,4 +11,5 @@
|
||||||
{% block initial_fields %}
|
{% block initial_fields %}
|
||||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||||
<input type="hidden" name="mention_books" value="{{ book.id }}">
|
<input type="hidden" name="mention_books" value="{{ book.id }}">
|
||||||
|
<input type="hidden" name="book" value="{{ book.id }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -12,7 +12,7 @@ from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.views.decorators.http import require_POST
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
from bookwyrm import models
|
from bookwyrm import forms, models
|
||||||
from .helpers import get_edition, handle_reading_status
|
from .helpers import get_edition, handle_reading_status
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,15 @@ class ReadingStatus(View):
|
||||||
|
|
||||||
# post about it (if you want)
|
# post about it (if you want)
|
||||||
if request.POST.get("post-status"):
|
if request.POST.get("post-status"):
|
||||||
|
# is it a comment?
|
||||||
|
if request.POST.get("content"):
|
||||||
|
form = forms.CommentForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
form.save()
|
||||||
|
else:
|
||||||
|
# uh oh
|
||||||
|
raise Exception("Invalid form")
|
||||||
|
else:
|
||||||
privacy = request.POST.get("privacy")
|
privacy = request.POST.get("privacy")
|
||||||
handle_reading_status(request.user, desired_shelf, book, privacy)
|
handle_reading_status(request.user, desired_shelf, book, privacy)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue