Skip to main content

A flake8 extension to validate django models ForeignKey fields on on_delete CASCADE comment

Project description


Build Status Maintainability Test Coverage

A flake8 extension to validate django models ForeignKey fields on on_delete CASCADE comment.

test_field = models.ForeignKey(  # allowed_cascade

CASCADE can be not safe to choose, so such fields should be marked by comment.


pip install flake8-django-on-delete-comment


Sample file:


first_field = models.ForeignKey(  # allowed_cascade

second_field = models.ForeignKey(

third_field = models.ForeignKey(


$ flake8 CD001 field needs a valid comment for on_delete


We would love you to contribute to our project. It's simple:

  1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. Be awesome.

Here are useful tips:

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

flake8_django_on_delete_comment-0.0.3.tar.gz (4.5 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page