Skip to main content

Bibsonomy/Zotero plugin for managing refernces in APIS framework

Project description

APIS Bibsonomy

APIS Bibsonomy is a small addon to the APIS system. It allows to store references in Bibsonomy instances and use these references in APIS. It is very generic and should work with most Django installations/projects.

Installation

  • Install the package:

    pip install apis-bibsonomy

  • Add the package to your installed apps:

    INSTALLED_APPS = [
    ...
    'apis_bibsonomy'
    ]
    
  • And migrate your DB:

    python manage.py migrate

Some functionality from APIS Bibsonomy uses htmx, so you should include htmx into your web application.

Configuration

APIS Bibsonomy needs an URL of the bibsonomy or zotero instance, a username, a API token and an (optional) collection to search in.

You need to add a configuration section to your APIS settings:

APIS_BIBSONOMY = [{
   'type': 'bibsomomy', #or zotero
   'url': 'http://url.at', #url of the bibsonomy instance or zotero.org
   'user': 'username', #for zotero use the user id number found in settings
   'API key': 'api_key',
   'group': 'group'
}]

If you want the plugin to add the reference buttons to certain fields you need to add these fields to the config:

APIS_BIBSONOMY_FIELDS = ['name', 'first_name', 'profession']

Restart your server and you are good to go.

htmx

APIS Bibsonomy uses htmx. The delete buttons for references trigger deletion via the API delete route which give an empty response on success. HTMX needs to be configured to swap the content even if the response is empty:

document.body.addEventListener('htmx:beforeSwap', function(event) {
  if (event.detail.xhr.status === 204) {
    // Swap content even when the response is empty.
    event.detail.shouldSwap = true;
  }
});

Usage

not needed if you are using standard APIS templates

  • Include the base template somewhere in the header of your template:

{% include 'apis_bibsonomy/apis_bibsonomy_include.html' %}

  • Load the templatetag:

{% load bibsonomy_templatetags %}

  • Include the form somewhere in your template (set hidden=True if you intend to use buttons):

{% bibsonomy_form content_type='person' hidden=True %}

  • And finally add html tags as anker element for the reference forms to your template (dont forget to set "bibsonomy-anker" as class):

<button class="bibsonomy-anker" data-bibs-contenttype="person" data-bibs-object_pk={{instance.pk}} data-bibs-attribute="Attribute name (optional)">Ref</button>

  • If you want to batch add reference forms to attribute fields in a whole form add a hidden anker element. You need to additionally add the names of the form fields you want to have reference forms for to data-bibs-form-elements=""

<button class="bibsonomy-anker-hidden" data-bibs-contenttype="person" data-bibs-object_pk={{instance.pk}} data-bibs-form-elements="first_name|name|gender|start_date_written|lat">Ref</button>

Licenses

The book icon used for the reference link is the SVG from the Import Contacts icon from the material symbols

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apis_bibsonomy-0.11.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

apis_bibsonomy-0.11.0-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file apis_bibsonomy-0.11.0.tar.gz.

File metadata

  • Download URL: apis_bibsonomy-0.11.0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for apis_bibsonomy-0.11.0.tar.gz
Algorithm Hash digest
SHA256 265f239448a715a74be1721cacdf33eb9c9bb29de90860800d8ec0cba811557a
MD5 54398c7325b904a9d3acdc4a3afd672d
BLAKE2b-256 be2536e544f3d99f2a007b907ee2de6d6b50c0c0973cf9093cba653ef7e2345f

See more details on using hashes here.

File details

Details for the file apis_bibsonomy-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for apis_bibsonomy-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c362024fddf276836dac65dc60b4921c899c760aa9b10695a274a24812bb944
MD5 fc64098fa323eabf8ca709f4d52d268a
BLAKE2b-256 bff94fde1ded50c4ff22a6e1870fd57a5c208281b76d42751a29796a79404fdb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page