Maintain default data and implement app hooks
- Feb 06, 2020
-
-
Tom Teichler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
-
Nik | Klampfradler authored
This change is primarily intended to allow models to declare their own default data, without having to use data migrations. Data migrations have the downside of being run only once, so e.g. `manage.py flush` will delete default data wchich will never be restored. Also, I consider it more natural todefine default data setup on model classes. In order to achieve that, this adds a generic interface for apps to register hooks called on several signals, by simply implementing methods with the same name on their AppConfig instance.
-