More model ids in urls
This commit is contained in:
parent
4297e8647d
commit
d71b451eef
|
@ -9,10 +9,9 @@
|
||||||
<label class="delete" for="finish-reading-{{ uuid }}" aria-label="close" role="button"></label>
|
<label class="delete" for="finish-reading-{{ uuid }}" aria-label="close" role="button"></label>
|
||||||
</header>
|
</header>
|
||||||
{% active_read_through book user as readthrough %}
|
{% active_read_through book user as readthrough %}
|
||||||
<form name="finish-reading" action="/finish-reading" method="post">
|
<form name="finish-reading" action="/finish-reading/{{ book.id }}" method="post">
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
|
|
|
@ -7,10 +7,9 @@
|
||||||
<p class="modal-card-title">Start "{{ book.title }}"</p>
|
<p class="modal-card-title">Start "{{ book.title }}"</p>
|
||||||
<label class="delete" for="start-reading-{{ uuid }}" aria-label="close" role="button" tabindex="0"></label>
|
<label class="delete" for="start-reading-{{ uuid }}" aria-label="close" role="button" tabindex="0"></label>
|
||||||
</header>
|
</header>
|
||||||
<form name="start-reading" action="/start-reading" method="post">
|
<form name="start-reading" action="/start-reading/{{ book.id }}" method="post">
|
||||||
<section class="modal-card-body">
|
<section class="modal-card-body">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
Started reading
|
Started reading
|
||||||
|
|
|
@ -118,15 +118,15 @@ urlpatterns = [
|
||||||
re_path(r'^boost/(?P<status_id>\d+)/?$', actions.boost),
|
re_path(r'^boost/(?P<status_id>\d+)/?$', actions.boost),
|
||||||
re_path(r'^unboost/(?P<status_id>\d+)/?$', actions.unboost),
|
re_path(r'^unboost/(?P<status_id>\d+)/?$', actions.unboost),
|
||||||
|
|
||||||
re_path(r'^delete-status/?$', actions.delete_status),
|
re_path(r'^delete-status/(?P<status_id>\d+)/?$', actions.delete_status),
|
||||||
|
|
||||||
re_path(r'^create-shelf/?$', actions.create_shelf),
|
re_path(r'^create-shelf/?$', actions.create_shelf),
|
||||||
re_path(r'^edit-shelf/(?P<shelf_id>\d+)?$', actions.edit_shelf),
|
re_path(r'^edit-shelf/(?P<shelf_id>\d+)?$', actions.edit_shelf),
|
||||||
re_path(r'^delete-shelf/(?P<shelf_id>\d+)?$', actions.delete_shelf),
|
re_path(r'^delete-shelf/(?P<shelf_id>\d+)?$', actions.delete_shelf),
|
||||||
re_path(r'^shelve/?$', actions.shelve),
|
re_path(r'^shelve/?$', actions.shelve),
|
||||||
re_path(r'^unshelve/?$', actions.unshelve),
|
re_path(r'^unshelve/?$', actions.unshelve),
|
||||||
re_path(r'^start-reading/?$', actions.start_reading),
|
re_path(r'^start-reading/(?P<book_id>\d+)/?$', actions.start_reading),
|
||||||
re_path(r'^finish-reading/?$', actions.finish_reading),
|
re_path(r'^finish-reading/(?P<book_id>\d+)/?$', actions.finish_reading),
|
||||||
|
|
||||||
re_path(r'^follow/?$', actions.follow),
|
re_path(r'^follow/?$', actions.follow),
|
||||||
re_path(r'^unfollow/?$', actions.unfollow),
|
re_path(r'^unfollow/?$', actions.unfollow),
|
||||||
|
|
|
@ -345,9 +345,9 @@ def unshelve(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def start_reading(request):
|
def start_reading(request, book_id):
|
||||||
''' begin reading a book '''
|
''' begin reading a book '''
|
||||||
book = books_manager.get_edition(request.POST['book'])
|
book = books_manager.get_edition(book_id)
|
||||||
shelf = models.Shelf.objects.filter(
|
shelf = models.Shelf.objects.filter(
|
||||||
identifier='reading',
|
identifier='reading',
|
||||||
user=request.user
|
user=request.user
|
||||||
|
@ -380,9 +380,9 @@ def start_reading(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def finish_reading(request):
|
def finish_reading(request, book_id):
|
||||||
''' a user completed a book, yay '''
|
''' a user completed a book, yay '''
|
||||||
book = books_manager.get_edition(request.POST['book'])
|
book = books_manager.get_edition(book_id)
|
||||||
shelf = models.Shelf.objects.filter(
|
shelf = models.Shelf.objects.filter(
|
||||||
identifier='read',
|
identifier='read',
|
||||||
user=request.user
|
user=request.user
|
||||||
|
@ -551,8 +551,6 @@ def unboost(request, status_id):
|
||||||
@login_required
|
@login_required
|
||||||
def delete_status(request, status_id):
|
def delete_status(request, status_id):
|
||||||
''' delete and tombstone a status '''
|
''' delete and tombstone a status '''
|
||||||
if not status_id:
|
|
||||||
return HttpResponseBadRequest()
|
|
||||||
status = get_object_or_404(models.Status, id=status_id)
|
status = get_object_or_404(models.Status, id=status_id)
|
||||||
|
|
||||||
# don't let people delete other people's statuses
|
# don't let people delete other people's statuses
|
||||||
|
|
Loading…
Reference in New Issue