Fix Django deprecation warnings and code cleanup #109
+478 −136
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses deprecation warnings in the Django application and performs minor code cleanup to improve maintainability and future compatibility.
Changes Made
1. Fixed
pythonjsonloggerImport DeprecationFile:
settings.py"pythonjsonlogger.jsonlogger.JsonFormatter"→"pythonjsonlogger.json.JsonFormatter"jsonloggermodule has been moved tojsonin newer versions ofpython-json-logger, causing deprecation warnings.2. Fixed Django 6.0
URLFieldDeprecation WarningFile:
settings.pyFORMS_URLFIELD_ASSUME_HTTPS = TruesettingURLFieldfrom'http'to'https'.This setting silences the warning and opts into the new behavior.
3. Removed Unused Imports
Files:
settings.py: Removedfrom django.templatetags.static import statichomework.py: Removedfrom courses.validators.validating_json_field import ValidatingJSONFieldReason: These imports were not used in the code, leading to linting warnings and potential confusion.
Impact: Cleaner code, reduced import overhead, no functional changes.
Testing
pythonjsonloggerwarning eliminated)Impact Assessment
Motivation
These changes improve code quality and prepare the codebase for Django 6.0 by addressing deprecation warnings that would become errors in future versions.
The cleanup also enhances maintainability by removing unused code.
Checklist