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 thecontent_type_id
and theobject_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_bookmark-0.1.0.tar.gz
.
File metadata
- Download URL: django_bookmark-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 689959134f7d9ddc408c66564e8b3b188c242276f82cc2384bb50a4e670829b7 |
|
MD5 | 289c198ba74157b856502f473bcc3ef0 |
|
BLAKE2b-256 | a27f4e60352800948c0489921074e249ca4129dd2efe2167f6b831d2df040bf9 |
File details
Details for the file django_bookmark-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_bookmark-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f761187f53d48bd7ac5f27775f092d48a27d0573df4d462254c08274be34da0c |
|
MD5 | aacce3db18ebdb10626866e7d172f620 |
|
BLAKE2b-256 | 14b19a2b222728a4e10242d621ccf26f4c5e513157e64a6bf6d907704dec52af |