All Projects → abhiabhi94 → django-flag-app

abhiabhi94 / django-flag-app

Licence: MIT license
A pluggable django application that adds the ability for users to flag(or report) your models.

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to django-flag-app

telegram-report-bot
A simple bot to handle reports from users in your chat
Stars: ✭ 58 (+346.15%)
Mutual labels:  moderation
country-flag-emoji-json
Country flag emojis in JSON format.
Stars: ✭ 92 (+607.69%)
Mutual labels:  flag
grpc-django-book-service
gRPC implementation integrated with Django Application.
Stars: ✭ 28 (+115.38%)
Mutual labels:  django-rest-framework
matchering-web
🎚️ Self-Hosted LANDR / eMastered Alternative
Stars: ✭ 25 (+92.31%)
Mutual labels:  django-rest-framework
python-wechat-pay
Use Python3, Django, Django-rest-framework to achieve wechat payment. 微信支付、服务器异步通知、订单查询、退款
Stars: ✭ 18 (+38.46%)
Mutual labels:  django-rest-framework
FastReport.Documentation
FastReport Open Source Documentation
Stars: ✭ 81 (+523.08%)
Mutual labels:  report
flag
专为命令行爱好者设计,方便写出类似于git或者coreutils中的命令接口(ls, mv, cat),新用户建议使用https://github.com/guonaihong/clop
Stars: ✭ 48 (+269.23%)
Mutual labels:  flag
devops
基于python2.7.10+django1.11.6实现堡垒机,cmdb及批量任务功能
Stars: ✭ 23 (+76.92%)
Mutual labels:  django-rest-framework
type-flag
⛳️ Typed command-line arguments parser for Node.js
Stars: ✭ 105 (+707.69%)
Mutual labels:  flag
nullarbor
💾 📃 "Reads to report" for public health and clinical microbiology
Stars: ✭ 111 (+753.85%)
Mutual labels:  report
drf-addons
Some customised Django classes and functions that one can use in DJango. Collected from internet!
Stars: ✭ 20 (+53.85%)
Mutual labels:  django-rest-framework
wp-statistics
Complete WordPress Analytics and Statistics for your site!
Stars: ✭ 83 (+538.46%)
Mutual labels:  report
datart
Datart is a next generation Data Visualization Open Platform
Stars: ✭ 1,042 (+7915.38%)
Mutual labels:  report
Expense Tracker with Pdf report
An expense Tracker 🔥🔥 which lets you add transactions 🖊🖊 and generate a pdf report of all of your transactions📋📋
Stars: ✭ 16 (+23.08%)
Mutual labels:  report
django-test-addons
Testing support for different database system like Mongo, Redis, Neo4j, Memcache, Django Rest Framework for django
Stars: ✭ 20 (+53.85%)
Mutual labels:  django-rest-framework
My Dashboard
A dashboard powered by Django, showing a notepad, scraping news articles and finance data with dash.py
Stars: ✭ 54 (+315.38%)
Mutual labels:  django-rest-framework
django-mobile-app
A batteries-included mobile app backend in Django
Stars: ✭ 52 (+300%)
Mutual labels:  django-rest-framework
django-code-generator
Generate code from your Django models for faster development
Stars: ✭ 35 (+169.23%)
Mutual labels:  django-rest-framework
smart-home
Control house using raspberry pi djago based secure REST api. Made using raspberry pi, arduino, django ,django REST and angular.
Stars: ✭ 30 (+130.77%)
Mutual labels:  django-rest-framework
poke
A simple tool to check your site for broken links, media, iframes, stylesheets, scripts, forms or metadata.
Stars: ✭ 24 (+84.62%)
Mutual labels:  report

django-flag-app

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.

flagging-process

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

Installation

Install using pip

$ pip install django-flag-app

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

$ git clone git://github.com/abhiabhi94/django-flag-app.git
$ cd django-flag-app
$ python setup.py 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:

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

Add URL

In your root urls.py:

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:

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:

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.

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 %}

Contributing

Please see the instructions at Contributing.rst.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].