Django + Fighting Spam Made Easy
Project description
Django + Flagging Spam Made Easy
Documentation
The full documentation is at https://dj-spam.readthedocs.org.
Features
For Django 1.8+
For Python 2.7/3.3+
Direct foreign key from the model to the spam report. Avoiding content types and using explicit foreign keys makes for less kludgy databases.
Powered by conventions used all over Django:
Have the appropriate __str__() or __unicode__() method on your models.
Flaggable models should have get_absolute_url() methods.
Quickstart
Install dj-spam:
pip install dj-spam
Configure it into your project:
# settings.py INSTALLED_APPS += ['spam', ]
# urls.py url(r'^spam/', include('spam.urls', namespace='spam')),
For any model you want to flag:
from spam import Spammable class MyModel(Spammable, models.Model): # Define your model here. Spammable attaches # the spam_flag field to your model as a ManyToManyField. @models.permalink def get_absolute_url(self): # Not required, but it allows dj-spam to link back to the offending # content in the report spam view. return 'absolute link to model detail view'
Run Migrations
./manage migrate
Then, in the model’s related view:
from spam import SpammableMixin class MyModelDetailView(SpammableMixin, DetailView): class = MyModel
This empowers you with the view method spam_report_url which you can use to define the URL to the reporting form:
<a href="{{ view.spam_report_url }}">Report Spam</a>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dj-spam-0.1.0.tar.gz
.
File metadata
- Download URL: dj-spam-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e16d7983685ce6c5a7869e1c09ad1bd24cfe92695a0f3b36814d6a0fdab44726 |
|
MD5 | e1f3a24550bc51850bc70733f0dbd256 |
|
BLAKE2b-256 | f5bd2c8014fbf74e90b71134f2199945f24809bbc99c7e0bd2167e916f12f504 |
File details
Details for the file dj_spam-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dj_spam-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6179ff3ac7ce154c6b0792cd5c1e988285f6c8549cfce7e487534292bec3b3a5 |
|
MD5 | 9f135d90dfcc63a9f2d31e7ba10cd2e6 |
|
BLAKE2b-256 | 78663cfbcc604cc9e591a5cbc7a013ec2c0dea0ba42c712d03a35a0bdc65f5ff |