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/dm/django-siteflags.svg https://img.shields.io/pypi/l/django-siteflags.svg https://img.shields.io/coveralls/idlesign/django-siteflags/master.svg https://img.shields.io/travis/idlesign/django-siteflags/master.svg https://landscape.io/github/idlesign/django-siteflags/master/landscape.svg?style=flat

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 django.db import models
from siteflags.models import ModelWithFlag


class Article(models.Model, 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, id):

    article = get_object_or_404(Article, pk=id)

    ...

    # Now a user adds this article to his bookmarks.
    article.set_flag(request.user)

    ...

Quite simple.

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-0.4.1.tar.gz (17.1 kB view hashes)

Uploaded Source

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