Skip to main content

Store bookmarks to Django model instances

Project description

Django Bookmark

A Django app that lets users create bookmarks to Django model instances

Installation

Install django-bookmark using your favourite package manager.

Add django_bookmark to your Django projects INSTALLED_APPS:

...
'django_bookmark',
...

Include django_bookmark.urls in your URL dispatcher:

...
path("", include("django_bookmark.urls")),
...

Django Bookmarks adds two routes below where you include the app:

  • /bookmarks/ is a view that lists all bookmarks of the user accessing it
  • /togglebookmark/<content_type_id>/<object_id> is a view to add or remove a bookmark, that points to the model instance specified by the content_type_id and the object_id. The bookmark will be saved with the user id of the user accessing the view.

Django Bookmarks ships the django_bookmark templatetags library, which currently consists of the templatetag toggle_bookmark. The toggle_bookmark templatetag takes the model instance as argument and adds a bookmark link that to your template. This bookmark link displayes a bookmark symbol that is either white, if the model instance is not bookmarked or yellow, if the model instance is bookmarked. Clicking the link toggles the bookmarking state of the model instance for the logged in user. If you have htmx included in your web application, the bookmarking link uses htmx to update the bookmark symbol, otherwise the link redirects to the page where you came from.

Django Bookmarks uses the Bookmark Add svg from the Material Symbols collection and the Bookmark svg from the Material Icons collection. Both are licensed under the SIL Open Font License.

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

django_bookmark-0.1.0.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

django_bookmark-0.1.0-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

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