Don't show lists a book is already on in add form
This commit is contained in:
parent
ab1c7c6d0a
commit
202696f913
|
@ -352,7 +352,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% if request.user.list_set.exists %}
|
{% if list_options.exists %}
|
||||||
<form name="list-add" method="post" action="{% url 'list-add-book' %}">
|
<form name="list-add" method="post" action="{% url 'list-add-book' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="book" value="{{ book.id }}">
|
<input type="hidden" name="book" value="{{ book.id }}">
|
||||||
|
@ -361,7 +361,7 @@
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="select control is-clipped">
|
<div class="select control is-clipped">
|
||||||
<select name="book_list" id="id_list">
|
<select name="book_list" id="id_list">
|
||||||
{% for list in user.list_set.all %}
|
{% for list in list_options %}
|
||||||
<option value="{{ list.id }}">{{ list.name }}</option>
|
<option value="{{ list.id }}">{{ list.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -83,6 +83,7 @@ class Book(View):
|
||||||
}
|
}
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
|
data["list_options"] = request.user.list_set.exclude(id__in=data["lists"])
|
||||||
data["file_link_form"] = forms.FileLinkForm()
|
data["file_link_form"] = forms.FileLinkForm()
|
||||||
readthroughs = models.ReadThrough.objects.filter(
|
readthroughs = models.ReadThrough.objects.filter(
|
||||||
user=request.user,
|
user=request.user,
|
||||||
|
|
Loading…
Reference in New Issue