Skip to main content

Reusable application for Django allowing users to flag/bookmark site objects

Project description

https://github.com/idlesign/django-siteflags

https://img.shields.io/pypi/v/django-siteflags.svg https://img.shields.io/pypi/l/django-siteflags.svg https://img.shields.io/coveralls/idlesign/django-siteflags/master.svg

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

http://django-siteflags.readthedocs.org/

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-siteflags-1.3.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

django_siteflags-1.3.0-py2.py3-none-any.whl (13.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-siteflags-1.3.0.tar.gz.

File metadata

  • Download URL: django-siteflags-1.3.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for django-siteflags-1.3.0.tar.gz
Algorithm Hash digest
SHA256 8ee5fe945daea5a8f6748c4473c435449117da2c3971bae11c243fe6c9119480
MD5 1727e65b32e7e494c2904441fe4bc5d1
BLAKE2b-256 4c16488c448fe219464a4269d6d4d8c06efc03ce15af8764321365fedead9606

See more details on using hashes here.

File details

Details for the file django_siteflags-1.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_siteflags-1.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fb18b6fe9981a3d802c78316e6b582abbccdd0bce241887615fb5ab255c6ec4a
MD5 613a84cc47abc0998b9636b4cfcfa460
BLAKE2b-256 aa7b59914e83d26e713a51950b7a3d90f682745161c4c338898a58615ccec495

See more details on using hashes here.

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