Note that we are using two submit inputs for each form, and all of them have
bookmarks_toggle html class: this is not required, but it makes easier for
a Javascript to show and hide them based on AJAX request, as described below.

The backend used to store and retreive bookmarks is always accessible
from the library registry.

While a complete description of backends can be found in Backends reference,
here is a brief summary of the API:

frombookmarks.handlersimportlibrary# get all bookmarks saved by a userbookmarks=library.backend.filter(user=user)# get all bookmarks of a specified instance and keybookmarks=library.backend.filter(instance=article,key='likes')# get all articles bookmarksbookmarks=library.backend.filter(model=Article)# add/remove bookmarksbookmark=library.backend.add(user,article,'likes')bookmark=library.backend.remove(user,article,'likes')# get a bookmarkbookmark=library.backend.get(user,article,'likes')# check for bookamrk existanceexists=library.backend.exists(user,article,'likes')