py-v1.12.0 - django-mptt models are no longer invisible
Added
-
django-mptt models are no longer invisible.
MPTTModelmatched none of
the base-class patterns the parser recognises, so aclass Category(MPTTModel)
was dropped before a single field was read — absent from the sidebar, the ER
diagram, and every analyzer. Closing that alone would not have been enough:
TreeForeignKey,TreeOneToOneFieldandTreeManyToManyFieldare checked
against a literal whitelist too, so the model would have surfaced with its
scalar fields and no edges at all — worse than hidden, because it looks
complete. Both halves are fixed. TheTree*fields are thin subclasses of
Django's own relation fields, so they are reported as the field they
subclass:TreeForeignKey('self', ...)produces exactly the self-edge a
plainForeignKey('self', ...)does, honouringon_deleteand
related_name, and nothing downstream needs to learn about mptt.Measured on the vendored corpus: Saleor's
product.Category— a real
MPTTModelwith a self-referentialparent— now appears in the golden
snapshot with all of its fields and itschildrenedge. The snapshot diff
is 76 added lines and no removed ones, so nothing that used to parse was
disturbed.Additive and import-free by design: no
django-mpttdependency, so the
parser keeps working against a project whose venv is broken. Mirrored in
src/parser.tsso the extension and the CLI cannot disagree about a schema.
Closes #49.
Fixed
DOL021documented theUSE_TZdefault wrongly, and overstated what
timezone.now()returns. The page claimedUSE_TZ=Truewas "Django's
default since 4.0". It was not: the framework default in
django.conf.global_settingsstayedFalsethrough 4.2 and becameTrue
only in 5.0. Since 4.0 thestartprojecttemplate writesUSE_TZ = True
into generated settings, which is a separate thing — a project upgraded to
4.x keepsFalseuntil someone sets it. Collapsing the two misled exactly
the most common reader: an existing 4.x project with the setting untouched.
The page also calledtimezone.now()"an aware UTC datetime" flatly, when
it follows the setting and returns naive local time underUSE_TZ=False.
The same claim was duplicated insrc/rules/datetime.tsand is corrected
there too. Found by @Justine0211 while
translating the page, by declining to translate a statement they could not
verify against the Django release notes.
Changed
- The
parity_input.pytest fixture now carries thefrom django.db import modelsimport a realmodels.pywould have. No behaviour change — the
parity test asserts model shape, never line numbers — but the fixture reads
as genuine Django, and starts clean if that directory is ever linted.
Contributed by @RinZ27 in
#64.