Work in Progress: dj-spam
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>
admin
dj-spam comes with a simple admin view.
emailing managers
dj-spam emails settings.MANAGERS every time something is flagged. If you don’t set settings.MANAGERS, it will email settings.ADMINS.
History
0.2.0 (2-15-07-29)
Added admin functionality.
Fixed broken spam report form.
Email of managers when content is flagged as spam.
0.1.0 (2-15-07-28)
First release on PyPI.
Metadata
Release files for dj-spam 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dj-spam-0.2.0.tar.gz | 8.5 kB | Without provenance | Details for dj-spam-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dj_spam-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for dj_spam-0.2.0-py2.py3-none-any.whl |
Total release size: 19.5 kB
Release files / dj-spam-0.2.0.tar.gz
| Download URL | dj-spam-0.2.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73f2354493069d87961624cc33cd7d385eeec2c19a9617a2aa06716bac238d03
|
|
BLAKE2b-256 checksum How to use checksums |
9d95746f1c1e3b0db05b0deb8e7474be7e8e237618ea9abd8bd0fbbee7407b57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dj_spam-0.2.0-py2.py3-none-any.whl
| Download URL | dj_spam-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
825f7059fe008b133cefbb846780443c701bc6e84153953c635b1aa2368213dc
|
|
BLAKE2b-256 checksum How to use checksums |
7f41c2f7eae271f745afe7b394d18c2842e8df0c019ae3a0881cbe6c6db4a1e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for dj-spam 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.