Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/idlesign/django-siteflags
Reusable application for Django allowing users to flag/bookmark site objects
https://github.com/idlesign/django-siteflags
bookmark django flag python ratings
Last synced: 3 months ago
JSON representation
Reusable application for Django allowing users to flag/bookmark site objects
- Host: GitHub
- URL: https://github.com/idlesign/django-siteflags
- Owner: idlesign
- License: bsd-3-clause
- Created: 2014-08-04T13:25:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-04T01:18:06.000Z (over 2 years ago)
- Last Synced: 2024-10-03T13:22:09.691Z (4 months ago)
- Topics: bookmark, django, flag, python, ratings
- Language: Python
- Homepage: https://github.com/idlesign/django-siteflags
- Size: 102 KB
- Stars: 20
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
django-siteflags
================
https://github.com/idlesign/django-siteflags.. image:: https://img.shields.io/pypi/v/django-siteflags.svg
:target: https://pypi.python.org/pypi/django-siteflags.. image:: https://img.shields.io/pypi/l/django-siteflags.svg
:target: https://pypi.python.org/pypi/django-siteflags.. image:: https://img.shields.io/coveralls/idlesign/django-siteflags/master.svg
:target: https://coveralls.io/r/idlesign/django-siteflagsDescription
-----------*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:
.. code-block:: python
# myapp/models.py
from siteflags.models import ModelWithFlagclass Article(ModelWithFlag):
... # Some model fields here.
And like so:
.. code-block:: python
# myapp/views.py
from django.shortcuts import get_object_or_404
from .models import Articledef 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
-------------http://django-siteflags.readthedocs.org/