forked from mirrors/bookwyrm
Preserve readthrough id in edit
This commit is contained in:
parent
a412f87c64
commit
68d943fb26
2 changed files with 5 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% blocktrans trimmed with title=book|book_title %}
|
{% blocktrans trimmed with title=book|book_title %}
|
||||||
Add read dates for "<em>{{ title }}</em>"
|
Update read dates for "<em>{{ title }}</em>"
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,10 @@ class CreateReadThrough(View):
|
||||||
if not form.is_valid():
|
if not form.is_valid():
|
||||||
book = get_object_or_404(models.Edition, id=book_id)
|
book = get_object_or_404(models.Edition, id=book_id)
|
||||||
data = {"form": form, "book": book}
|
data = {"form": form, "book": book}
|
||||||
|
if request.POST.get("id"):
|
||||||
|
data["readthrough"] = get_object_or_404(
|
||||||
|
models.ReadThrough, id=request.POST.get("id")
|
||||||
|
)
|
||||||
return TemplateResponse(
|
return TemplateResponse(
|
||||||
request, "readthrough/readthrough.html", data
|
request, "readthrough/readthrough.html", data
|
||||||
)
|
)
|
||||||
|
@ -144,7 +148,6 @@ class CreateReadThrough(View):
|
||||||
return redirect("book", book_id)
|
return redirect("book", book_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def update_readthrough_on_shelve(
|
def update_readthrough_on_shelve(
|
||||||
user, annotated_book, status, start_date=None, finish_date=None
|
user, annotated_book, status, start_date=None, finish_date=None
|
||||||
|
|
Loading…
Reference in a new issue