Skip to main content

django-yabl

Yet another bookmarking library (yabl) for Django. Bookmark and tag arbitrary models.

AbstractBookmarkable contains bookmarks field. This enables arbitrary child models, e.g. Movies, Books, Laws, Clothes, etc., to inherit uniform properties for bookmarking and tagging.

The bookmarks field is mapped to a generic Bookmark model containing:

  1. the authenticated user adding the bookmark, i.e. the bookmarker;
  2. the concrete model instance referenced, i.e. the bookmarked;1 and
  3. a ManyToMany tags field which maps to a TagItem model.

AbstractBookmarkable

The abstraction makes each inheriting instance bookmarkable and taggable by authenticated users.

Attributes Purpose
is_bookmarked(user) Check whether object instance is bookmarked or not
get_bookmarked(user) Get instances of model that user has bookmarked
get_user_tags(user) If user bookmarked, get user-made tags on instance
toggle_bookmark(user) Toggle bookmark status as bookmarked or not
add_tags(user, tags: list[str]) Add unique tags, accepts a list of names
remove_tag(user, tag: str) Delete an existing tag name from tags previously added
set_bookmarked_context(user) Combines relevant urls and attributes for template output
@modal Custom modal enables: toggle, add tags, remove tag
@launch_modal_url URL to launch custom modal
@get_item_url URL to load the panel containde within custom modal
@add_tags_url URL to POST tags added
@del_tag_url URL to DELETE tag added
@toggle_status_url URL to toggle bookmark status of an object instance added
@object_content_for_panel Content when custom modal is loaded; must be overriden

Modal-based UX

What is the concept?

The modal is where the user interacts – i.e. toggle bookmark status, add tags, remove tag (see table above) – with the data.

How is the modal styled?

See the htmx/hyperscript example modal.css.

How is the modal constructed during run-time?

See app-level modal.html which shows a modal via htmx click on the @launch_modal_url property.

What are the pre-made contents of the modal?

The app-level panel.html, contained within the modal, shows an actionable form for saving the bookmarable object and associating said object with tags:

  1. The submission of tags is POST'ed through the add_tags_url.
  2. The deletion of tags is DELETE'ed through the del_tag_url.
  3. The bookmark toggle is PUT'ed through the toggle_status_url.

Setup

  1. Download and install.
  2. See configuration of models to be bookmarked and tagged.
  3. Examine frontend setup using htmx/hyperscript.
  1. The model is referenced via a content_type and an object_id

Release files for django-yabl 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-yabl 0.2.0
File Size Uploaded
django-yabl-0.2.0.tar.gz 56.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-yabl 0.2.0
File Interpreter ABI Platform
django_yabl-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 120.9 kB

Release files / django-yabl-0.2.0.tar.gz

Download URL django-yabl-0.2.0.tar.gz
Size 56.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4798646ad851c611a82633a9e401e7074070fd9f89bc8b932e53d1b7ba34ee33
BLAKE2b-256 checksum
How to use checksums
638acbb428fc8f504d98259b6eab15786fbda95fd07d476d5705ea64d6e04d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.10.2 Darwin/21.3.0

Release files / django_yabl-0.2.0-py3-none-any.whl

Download URL django_yabl-0.2.0-py3-none-any.whl
Size 64.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5c47434cbdad3d02b78245f399719a22c1e2994ae57c7c54c963dea5854a9ee
BLAKE2b-256 checksum
How to use checksums
0d58f9a494d23f357360dae392c6c2bfb3ffbc7ab4698575a5f6b96d22ffd37d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0a2 CPython/3.10.2 Darwin/21.3.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page