#36839: Renaming of content types on RenameModel operations silently passes when
duplicates are found
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: | Version:
contrib.contenttypes |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by mag123c):
I looked into this issue and traced the behavior in
`django/contrib/contenttypes/management/__init__.py`.
When `IntegrityError` is caught during the rename (lines 29-33), the code
silently reverts to the old model name. The comment mentions
`remove_stale_contenttypes` will handle it, but as noted, this is now an
optional management command - users have no way of knowing the rename
failed.
Possible approaches:
1. Emit a warning via `warnings.warn()` when the conflict occurs
2. Log at WARNING level so it appears in server logs
3. Raise an exception (though this may be too disruptive)
I'm curious whether the silent behavior was intentional for backwards
compatibility, or if surfacing this to users would be welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/36839#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019b7c1666f5-314f9504-85ce-4b47-a30f-22f8b26c717a-000000%40eu-central-1.amazonses.com.