#22322 closed Bug (fixed)
inspectdb and managed option, incorrect explanation
Reported by: | Owned by: | Tim Graham | |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
https://docs.djangoproject.com/en/1.6/howto/legacy-databases/
"If you wanted to modify existing data on your CENSUS_PERSONS SQL table with Django you’d need to change the managed option highlighted above to True (or simply remove it to let it because True is its default value).
This serves as an explicit opt-in to give your nascent Django project write access to your precious data on a model by model basis.
Changed in Django 1.6:
The behavior by which introspected models are created as unmanaged ones is new in Django 1.6.
"
If you click on the managed link in the above you get:
"If False, no database table creation or deletion operations will be performed for this model. This is useful if the model represents an existing table or a database view that has been created by some other means. This is the only difference when managed=False. All other aspects of model handling are exactly the same as normal. This includes"
My use experience is that managed does not have anything to do with record creation/deletion just model creation/deletion as in the second text above. It would seem the texts should be brought into agreement.
Change History (6)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
FYI this also shows up in the comments section of the models.py generated by inspectedb as:
- Remove
managed = False
lines for those models you wish to give write DB access
Thanks for working on this.
comment:3 by , 11 years ago
Has patch: | set |
---|
Pull request for review. I plan to backport this to 1.6 but will remove the bit about table modification since we don't have schema migrations there.
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Yes, the text added in #14305 describes
managed
incorrectly.