X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/650db5dfe3ae7ddd3d9e6b93d5ca1f84b20f7309..2aaa98ee15d4e5032b4d4f0c83c140636fb8b10e:/apps/catalogue/forms.py?ds=sidebyside diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index d1235e85..657a1b04 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -104,9 +104,13 @@ class BookAppendForm(forms.Form): Form for appending a book to another book. It means moving all chunks from book A to book B and deleting A. """ - append_to = forms.ModelChoiceField(queryset=Book.objects.all(), - label=_("Append to")) + label=_("Append to")) + + def __init__(self, book, *args, **kwargs): + ret = super(BookAppendForm, self).__init__(*args, **kwargs) + self.fields['append_to'].queryset = Book.objects.exclude(pk=book.pk) + return ret class BookForm(forms.ModelForm):