Example #1
0
def addbookbyisbn(request):
    from tools import isbntools
    isbnform = ISBNBookForm(request.POST)
    if isbnform.is_valid():
        try:
            internalapi.import_by_isbn(isbnform.cleaned_data['isbn'])
        except Exception:
            return HttpResponse("something went wrong. could not import data for ISBN %s" % isbnform.cleaned_data['isbn'])
        else:
            return HttpResponseRedirect("/book/edit/"+isbntools.strip(isbnform.cleaned_data['isbn']))
Example #2
0
def import_by_isbn(request, isbn, user):
    """import a book using a foreign api lookup on an isbn"""
    internalapi.import_by_isbn(isbn)