Reusable application for Django allowing users to flag/bookmark site objects
Project description
https://github.com/idlesign/django-siteflags
Description
Reusable application for Django allowing users to flag/bookmark site objects
So you want a user to be able to put some flags on certain site entities.
Let’s say you need a kind of bookmark powered service, or a site where content is flagged and moderated, or a simplified rating system, or something similar.
Inherit you model from siteflags.models.ModelWithFlag and you’re almost done.
Like that:
# myapp/models.py
from siteflags.models import ModelWithFlag
class Article(ModelWithFlag):
... # Some model fields here.
And like so:
# myapp/views.py
from django.shortcuts import get_object_or_404
from .models import Article
def article_details(request, article_id):
article = get_object_or_404(Article, pk=article_id)
user = request.user
article.set_flag(user)
article.is_flagged(user)
article.remove_flag(user)
...
Quite simple. Quite generic. Read the documentation.
Documentation
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
django-siteflags-1.2.0.tar.gz
(17.0 kB
view hashes)
Built Distribution
Close
Hashes for django_siteflags-1.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e2a3cebcab350c0a5353382aca466bd320a8c43ab5b058b14261f6bafaa419b |
|
MD5 | 5e80d6bd4587449567c3218dc05e09a4 |
|
BLAKE2b-256 | 826e7ce7b4bf03937908a0facda20ba0424e35479fbb3e8c37244de52d939f0a |