Merge pull request #2948 from bookwyrm-social/populate-sort-title
Pre-populate sort title in edit book form if not provided
This commit is contained in:
commit
c2196fb704
2 changed files with 12 additions and 10 deletions
|
@ -32,6 +32,9 @@ class EditBook(View):
|
|||
def get(self, request, book_id):
|
||||
"""info about a book"""
|
||||
book = get_edition(book_id)
|
||||
# This doesn't update the sort title, just pre-populates it in the form
|
||||
if book.sort_title in ["", None]:
|
||||
book.sort_title = book.guess_sort_title()
|
||||
if not book.description:
|
||||
book.description = book.parent_work.description
|
||||
data = {"book": book, "form": forms.EditionForm(instance=book)}
|
||||
|
@ -40,6 +43,7 @@ class EditBook(View):
|
|||
def post(self, request, book_id):
|
||||
"""edit a book cool"""
|
||||
book = get_object_or_404(models.Edition, id=book_id)
|
||||
|
||||
form = forms.EditionForm(request.POST, request.FILES, instance=book)
|
||||
|
||||
data = {"book": book, "form": form}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue