+
+
+@permission_required('documents.change_book')
+def attach_book_to_catalogue(request, pk):
+ dbook = get_object_or_404(Book, pk=pk)
+ if dbook.dc_slug:
+ cbook = get_object_or_404(catalogue.models.Book, slug=dbook.dc_slug)
+ dbook.catalogue_book = cbook
+ dbook.save()
+ return http.HttpResponseRedirect(dbook.get_absolute_url())