Skip to main content

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

Project description

Test Coverage Latest PyPi version python django docs licence

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


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


Install using pip

$ pip install django-flag-app

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

$ git clone git://
$ cd django-flag-app
$ python install


Add app

To enable django_flag_app in your project you need to add it to INSTALLED_APPS in your projects file:



In your root

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


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

python migrate flag

Connect the flag model with the target model

In 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:

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)

Use template tag

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

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.

{% render_flag_form post user request %}


Please see the instructions at Contributing.rst.

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-flag-app-1.3.0.tar.gz (18.6 kB view hashes)

Uploaded source

Built Distribution

django_flag_app-1.3.0-py3-none-any.whl (21.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page