Metadata-Version: 2.5
Name: django-siteflags
Version: 1.3.1
Summary: Reusable application for Django allowing users to flag/bookmark site objects
Project-URL: Homepage, https://github.com/idlesign/django-siteflags
Project-URL: Documentation, https://django-siteflags.readthedocs.io/
Author-email: Igor Starikov <idlesign@yandex.ru>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: Django,bookmarks,flags
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: django-etc>=1.2.0
Description-Content-Type: text/markdown

# django-siteflags

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

[![release](https://img.shields.io/pypi/v/django-siteflags.svg)](https://pypi.python.org/pypi/django-siteflags)
[![lic](https://img.shields.io/pypi/l/django-siteflags.svg)](https://pypi.python.org/pypi/django-siteflags)
[![coverage](https://img.shields.io/coveralls/idlesign/django-siteflags/master.svg)](https://coveralls.io/r/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:

```python
# myapp/models.py
from siteflags.models import ModelWithFlag


class Article(ModelWithFlag):

    ...  # Some model fields here.
```

And like so:

```python
# 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

<https://django-siteflags.readthedocs.io/>
