djangodjango-models

Usage of managed=False option in Django models


In django models we have option named managed which can be set True or False

According to documentation the only difference this option makes is whether table will be managed by django or not. Is management by django or by us makes any difference?

Is there any pros and cons of using one option rather than other?

I mean why would we opt for managed=False? Will it give some extra control or power which affects my code?


Solution

  • The main reason for using managed=False is if your model is backed by something like a database view, instead of a table - so you don't want Django to issue CREATE TABLE commands when you run syncdb.