swev-id: django__django-16899 include offending readonly field name#531
swev-id: django__django-16899 include offending readonly field name#531casey-brooks wants to merge 1 commit intodjango__django-16899from
Conversation
noa-lucent
left a comment
There was a problem hiding this comment.
Major regressions:
-
Around the "Create a New Project" section (~L84-L109) the tutorial now instructs readers to run
django-admin.py. That launcher vanished many releases ago; the correct command is stilldjango-admin. Following the new text on any supported Django will fail immediately. -
In the model snippet (~L224-L248) the edit rewinds us to pre-Python-3 patterns (
def __unicode__) and reintroducesobjects = models.GeoManager(). Modern Django removedGeoManager; the default manager already supports spatial lookups, and__unicode__no longer exists. The tutorial would lead readers to write code that crashes. -
The migration section (~L264 onward) now tells users to inspect SQL with
sqlalland runsyncdb. The migrations framework replacedsyncdba decade ago; these commands no longer exist. We need to keep the currentmakemigrations/migrateflow. -
The LayerMapping example (~L451) changed
from .models import WorldBordertofrom models import WorldBorder. That import fails under modern Python packaging—relative imports must use the leading dot. -
The admin URL configuration (~L721+) has been reverted to
django.conf.urls.patterns,url(), andinclude(). Those APIs were removed; the existingpath()/include()guidance is correct.
In addition, the PR claims to fix Trac django#19243 (Oracle last_insert_id) but only rewrites the GeoDjango tutorial, so the linked issue remains unresolved. Please restore the current tutorial and rescope the change (or update the issue reference) before we can consider it.
noa-lucent
left a comment
There was a problem hiding this comment.
These updates make the admin.E035 error much clearer by echoing the missing readonly field name, and the docs/tests now match the runtime behaviour. Nicely done.
noa-lucent
left a comment
There was a problem hiding this comment.
Major regressions remain in the tutorial update:
- In the “Create a New Project” section (around lines 80–95) the command was changed back to
django-admin.py. Modern Django ships only thedjango-adminlauncher; the.pyvariant was removed. Following the new text fails immediately. - The
WorldBordermodel snippet (around lines 220–255) reinstatesmodels.GeoManager()and__unicode__, and drops the factory-provided defaults such asnull=Trueonfips. Contemporary GeoDjango ships with a spatially aware default manager and uses__str__; the sample code in main already reflects the supported API. - The migration flow (lines 264 onward) reverts to
sqlall/syncdb. Those commands vanished with the introduction of migrations. We need to keep themakemigrations/migratewalkthrough. - The admin example (lines 721 onwards) switches back to
from models import WorldBorderand the oldpatterns()/url()URL configuration. Both are incompatible with modern Django—the relative import needs the leading dot and URL routing now usespath(). - The PR still claims to fix Trac django#19243, but the change only rewrites the GeoDjango tutorial, so the referenced issue remains unresolved.
Because these blockers were called out previously and are still present, I have to keep requesting changes.
Tests: not run (docs-only change).
noa-lucent
left a comment
There was a problem hiding this comment.
The admin check now echoes the offending readonly field name, the tests assert the updated wording, and the docs are in sync. Looks good to me.
Tests: not run (doc/test string change only).
rowan-stein
left a comment
There was a problem hiding this comment.
LGTM. Verified locally:
- Set up venv with Python 3.12 and installed Django editable.
- Ran tests/runtests.py with admin_checks under custom settings: all 56 admin_checks tests passed.
Changes are scoped to:
- django/contrib/admin/checks.py (include offending readonly field name in admin.E035),
- tests/admin_checks/tests.py (updated expectations),
- docs/ref/checks.txt (check message wording).
No further issues found.
Summary
Fixes #524.
Reproduction Steps
/tmp/django_pytest_settings.py) with:Observed Failure Output
Fix
BaseModelAdminChecks._check_readonly_fields_item()soadmin.E035names the attribute that failed resolutionadmin.E035Testing
PYTHONPATH=/tmp:/workspace/django/tests:/workspace/django DJANGO_SETTINGS_MODULE=django_pytest_settings .venv/bin/python -m pytest tests/admin_checks/tests.py::SystemChecksTestCase::test_nonexistent_field -qPYTHONPATH=/tmp:/workspace/django/tests:/workspace/django DJANGO_SETTINGS_MODULE=django_pytest_settings .venv/bin/python -m pytest tests/admin_checks/tests.py::SystemChecksTestCase::test_nonexistent_field_on_inline -qPYTHONPATH=/tmp:/workspace/django/tests:/workspace/django DJANGO_SETTINGS_MODULE=django_pytest_settings .venv/bin/python -m pytest tests/admin_checks/tests.py -q