Skip to content

Commit

Permalink
added a fastdev_ignore decorator to allow force skipping fastdev chec…
Browse files Browse the repository at this point in the history
…ks (only applies to form checking right now)
  • Loading branch information
Naggafin committed Dec 24, 2024
1 parent c547b65 commit 6ebf020
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions django_fastdev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from django.core.management.commands.runserver import Command

from .apps import fastdev_ignore # noqa

orig_check = Command.check
orig_check_migrations = Command.check_migrations

Expand Down
10 changes: 4 additions & 6 deletions django_fastdev/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,10 @@ def is_from_project(cls):
) and not module_path.startswith(venv_dir)


def fastdev_ignore():
def fastdev_ignore(target):
"""A decorator to exclude a function or class from fastdev checks."""
def decorator(target):
setattr(target, "fastdev_ignore", True)
return target
return decorator
setattr(target, "fastdev_ignore", True)
return target


def get_venv_folder_name():
Expand Down Expand Up @@ -411,7 +409,7 @@ def if_render_override(self, context):
def fastdev_full_clean(self):
orig_form_full_clean(self)
# check if class is from our project, or strict form checking is enabled
if is_from_project(type(self)) or strict_form_checking():
if is_from_project(type(self)) or strict_form_checking() and not getattr(self, 'fastdev_ignore', False):
from django.conf import settings
if settings.DEBUG:
prefix = 'clean_'
Expand Down

0 comments on commit 6ebf020

Please sign in to comment.