django-flag-app


Namedjango-flag-app JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryA pluggable django application that adds the ability for users to flag(or report) your models
upload_time2025-07-11 13:21:54
maintainerNone
docs_urlNone
authorAbhyudai
requires_python>=3.10
licenseNone
keywords django flag moderate report
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===============
django-flag-app
===============

.. image:: https://github.com/abhiabhi94/django-flag-app/actions/workflows/test.yml/badge.svg?branch=main
    :target: https://github.com/abhiabhi94/django-flag-app/actions
    :alt: Test

.. image:: https://codecov.io/gh/abhiabhi94/django-flag-app/branch/main/graph/badge.svg?token=1XFNVKMX4W
  :target: https://codecov.io/gh/abhiabhi94/django-flag-app
  :alt: Coverage

.. image:: https://badge.fury.io/py/django-flag-app.svg
    :target: https://pypi.org/project/django-flag-app/
    :alt: Latest PyPi version

.. image:: https://img.shields.io/pypi/pyversions/django-flag-app.svg
    :target: https://pypi.python.org/pypi/django-flag-app/
    :alt: python

.. image:: https://img.shields.io/pypi/djversions/django-flag-app.svg
    :target: https://pypi.python.org/pypi/django-flag-app/
    :alt: django

.. image:: https://readthedocs.org/projects/django-flag-app/badge/?version=latest
    :target: https://django-flag-app.readthedocs.io/?badge=latest
    :alt: docs

.. image:: https://img.shields.io/github/license/abhiabhi94/django-flag-app?color=gr
    :target: https://github.com/abhiabhi94/django-flag-app/blob/main/LICENSE
    :alt: licence


A pluggable django application that adds the ability for users to flag(report or moderate) your models.


.. image:: https://raw.githubusercontent.com/abhiabhi94/django-flag-app/main/docs/_static/images/django-flag-app.gif
    :alt: flagging-process


For complete documentation you may visit `Read the Doc`_. or see the `docs`_ directory.

.. _Read the Doc: https://django-flag-app.readthedocs.io
.. _docs: https://github.com/abhiabhi94/django-flag-app/blob/main/docs/

Installation
------------

Install using ``pip``

.. code:: sh

    $ pip install django-flag-app

If you want, you may install it from the source, grab the source code and install it.

.. code:: sh

    $ git clone git://github.com/abhiabhi94/django-flag-app.git
    $ cd django-flag-app
    $ pip install .

Usage
-----

Add app
````````

To enable ``django_flag_app`` in your project you need to add it to ``INSTALLED_APPS`` in your projects ``settings.py`` file:

.. code:: python

    INSTALLED_APPS = (
        ...
        'flag',
        ...
    )

Add URL
````````

In your root ``urls.py``:

.. code:: python

    urlpatterns = patterns(
            path('admin/', admin.site.urls),
            path('flag/', include('flag.urls')),
            ...
            path('api/', include('flag.api.urls')),  # only required for API Framework
            ...
        )

Migrate
````````

Run the migrations to add the new models to your database:

.. code:: sh

    python manage.py migrate flag


Connect the flag model with the target model
`````````````````````````````````````````````

In ``models.py`` add the field ``flags`` as a ``GenericRelation`` field to the required model.

E.g. for a ``Post`` model, you may add the field as shown below:

.. code:: python

    from django.contrib.contenttypes.fields import GenericRelation

    from flag.models import Flag


    class Post(models.Model):
        user = models.ForeignKey(User)
        title = models.CharField(max_length=200)
        body = models.TextField()
        # the field name should be flags
        flags = GenericRelation(Flag)

.. important::


    the name of the field should be **flags**.


Use template tag
`````````````````

If you want to use web API, this step is not required. See further instructions at `Web API`_.

.. _Web API: https://github.com/abhiabhi94/django-flag-app/blob/main/docs/webAPI.rst

``render_flag_form`` tag requires 3 required positional arguments:

    1. Instance of the targeted model.
    2. User object.
    3. Request object

To render the ``flag`` form for a the instance ``post``, place this inside your detail view, perhaps in some template of the sort ``postdetail.html``.

.. code:: jinja

    {% render_flag_form post user request %}



Contributing
------------

Please see the instructions at `Contributing.rst`_.

.. _Contributing.rst: https://github.com/abhiabhi94/django-flag-app/blob/main/CONTRIBUTING.rst

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-flag-app",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "django, flag, moderate, report",
    "author": "Abhyudai",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d4/79/67e74db44c4fa66a31a0cfd224894a262ecea3ee91c3bc56117d6f2388f5/django_flag_app-2.0.0.tar.gz",
    "platform": null,
    "description": "===============\ndjango-flag-app\n===============\n\n.. image:: https://github.com/abhiabhi94/django-flag-app/actions/workflows/test.yml/badge.svg?branch=main\n    :target: https://github.com/abhiabhi94/django-flag-app/actions\n    :alt: Test\n\n.. image:: https://codecov.io/gh/abhiabhi94/django-flag-app/branch/main/graph/badge.svg?token=1XFNVKMX4W\n  :target: https://codecov.io/gh/abhiabhi94/django-flag-app\n  :alt: Coverage\n\n.. image:: https://badge.fury.io/py/django-flag-app.svg\n    :target: https://pypi.org/project/django-flag-app/\n    :alt: Latest PyPi version\n\n.. image:: https://img.shields.io/pypi/pyversions/django-flag-app.svg\n    :target: https://pypi.python.org/pypi/django-flag-app/\n    :alt: python\n\n.. image:: https://img.shields.io/pypi/djversions/django-flag-app.svg\n    :target: https://pypi.python.org/pypi/django-flag-app/\n    :alt: django\n\n.. image:: https://readthedocs.org/projects/django-flag-app/badge/?version=latest\n    :target: https://django-flag-app.readthedocs.io/?badge=latest\n    :alt: docs\n\n.. image:: https://img.shields.io/github/license/abhiabhi94/django-flag-app?color=gr\n    :target: https://github.com/abhiabhi94/django-flag-app/blob/main/LICENSE\n    :alt: licence\n\n\nA pluggable django application that adds the ability for users to flag(report or moderate) your models.\n\n\n.. image:: https://raw.githubusercontent.com/abhiabhi94/django-flag-app/main/docs/_static/images/django-flag-app.gif\n    :alt: flagging-process\n\n\nFor complete documentation you may visit `Read the Doc`_. or see the `docs`_ directory.\n\n.. _Read the Doc: https://django-flag-app.readthedocs.io\n.. _docs: https://github.com/abhiabhi94/django-flag-app/blob/main/docs/\n\nInstallation\n------------\n\nInstall using ``pip``\n\n.. code:: sh\n\n    $ pip install django-flag-app\n\nIf you want, you may install it from the source, grab the source code and install it.\n\n.. code:: sh\n\n    $ git clone git://github.com/abhiabhi94/django-flag-app.git\n    $ cd django-flag-app\n    $ pip install .\n\nUsage\n-----\n\nAdd app\n````````\n\nTo enable ``django_flag_app`` in your project you need to add it to ``INSTALLED_APPS`` in your projects ``settings.py`` file:\n\n.. code:: python\n\n    INSTALLED_APPS = (\n        ...\n        'flag',\n        ...\n    )\n\nAdd URL\n````````\n\nIn your root ``urls.py``:\n\n.. code:: python\n\n    urlpatterns = patterns(\n            path('admin/', admin.site.urls),\n            path('flag/', include('flag.urls')),\n            ...\n            path('api/', include('flag.api.urls')),  # only required for API Framework\n            ...\n        )\n\nMigrate\n````````\n\nRun the migrations to add the new models to your database:\n\n.. code:: sh\n\n    python manage.py migrate flag\n\n\nConnect the flag model with the target model\n`````````````````````````````````````````````\n\nIn ``models.py`` add the field ``flags`` as a ``GenericRelation`` field to the required model.\n\nE.g. for a ``Post`` model, you may add the field as shown below:\n\n.. code:: python\n\n    from django.contrib.contenttypes.fields import GenericRelation\n\n    from flag.models import Flag\n\n\n    class Post(models.Model):\n        user = models.ForeignKey(User)\n        title = models.CharField(max_length=200)\n        body = models.TextField()\n        # the field name should be flags\n        flags = GenericRelation(Flag)\n\n.. important::\n\n\n    the name of the field should be **flags**.\n\n\nUse template tag\n`````````````````\n\nIf you want to use web API, this step is not required. See further instructions at `Web API`_.\n\n.. _Web API: https://github.com/abhiabhi94/django-flag-app/blob/main/docs/webAPI.rst\n\n``render_flag_form`` tag requires 3 required positional arguments:\n\n    1. Instance of the targeted model.\n    2. User object.\n    3. Request object\n\nTo render the ``flag`` form for a the instance ``post``, place this inside your detail view, perhaps in some template of the sort ``postdetail.html``.\n\n.. code:: jinja\n\n    {% render_flag_form post user request %}\n\n\n\nContributing\n------------\n\nPlease see the instructions at `Contributing.rst`_.\n\n.. _Contributing.rst: https://github.com/abhiabhi94/django-flag-app/blob/main/CONTRIBUTING.rst\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A pluggable django application that adds the ability for users to flag(or report) your models",
    "version": "2.0.0",
    "project_urls": {
        "Documentation": "https://django-flag-app.readthedocs.io",
        "Homepage": "https://github.com/abhiabhi94/django-flag-app",
        "Source Code": "https://github.com/abhiabhi94/django-flag-app"
    },
    "split_keywords": [
        "django",
        " flag",
        " moderate",
        " report"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "35e60e9db1f6a8c9a3286893a6f8f2098bc56e66afd6b372124a674480f14378",
                "md5": "5e1db665f49892b96c797e8782d68fe4",
                "sha256": "e3c364d699416d7a481b6b08badf3c6dd92d3b158575bb12b4a3da80f36ca440"
            },
            "downloads": -1,
            "filename": "django_flag_app-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e1db665f49892b96c797e8782d68fe4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 21249,
            "upload_time": "2025-07-11T13:21:53",
            "upload_time_iso_8601": "2025-07-11T13:21:53.426529Z",
            "url": "https://files.pythonhosted.org/packages/35/e6/0e9db1f6a8c9a3286893a6f8f2098bc56e66afd6b372124a674480f14378/django_flag_app-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d47967e74db44c4fa66a31a0cfd224894a262ecea3ee91c3bc56117d6f2388f5",
                "md5": "cdae8122940b83d2d638e814b120402a",
                "sha256": "29898fa7b9c3aea66f8b4c98f92c1b6063784d9e60fca8a3d71fddcb6f2b13e7"
            },
            "downloads": -1,
            "filename": "django_flag_app-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cdae8122940b83d2d638e814b120402a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16342,
            "upload_time": "2025-07-11T13:21:54",
            "upload_time_iso_8601": "2025-07-11T13:21:54.593967Z",
            "url": "https://files.pythonhosted.org/packages/d4/79/67e74db44c4fa66a31a0cfd224894a262ecea3ee91c3bc56117d6f2388f5/django_flag_app-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 13:21:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "abhiabhi94",
    "github_project": "django-flag-app",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-flag-app"
}
        
Elapsed time: 0.45341s