REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 1.48 KB
Close
//opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint_django/checkers/forms.py
Text
Base64
"""Models.""" from astroid.nodes import Assign, AssignName, ClassDef from pylint.checkers import BaseChecker from pylint.checkers.utils import check_messages from pylint.interfaces import IAstroidChecker from pylint_django.__pkginfo__ import BASE_ID from pylint_django.utils import node_is_subclass def _get_child_meta(node): for child in node.get_children(): if isinstance(child, ClassDef) and child.name == "Meta": return child return None class FormChecker(BaseChecker): """Django model checker.""" __implements__ = IAstroidChecker name = "django-form-checker" msgs = { f"W{BASE_ID}04": ( "Use explicit fields instead of exclude in ModelForm", "modelform-uses-exclude", "Prevents accidentally allowing users to set fields, especially when adding new fields to a Model", ) } @check_messages("modelform-uses-exclude") def visit_classdef(self, node): """Class visitor.""" if not node_is_subclass(node, "django.forms.models.ModelForm", ".ModelForm"): # we only care about forms return meta = _get_child_meta(node) if not meta: return for child in meta.get_children(): if not isinstance(child, Assign) or not isinstance(child.targets[0], AssignName): continue if child.targets[0].name == "exclude": self.add_message(f"W{BASE_ID}04", node=child) break
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2026-02-06 07:30:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
auth_user.py
1.36 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
django_installed.py
1.29 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
foreign_key_strings.py
6.17 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
forms.py
1.48 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
json_response.py
2.64 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
migrations.py
6.28 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
models.py
4.50 KB
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
802 B
lrw-r--r--
2026-01-20 13:01:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).