If I’m building an application that will have over 30 models, and I want the option to plug in a custom manager or other functionality into all the models down the road, is it a good idea to use an abstract base model and subclass it with every model, or is there compelling reasons not to do this?
Share
I started doing Django before the Great ORM Rewrite, so I got in the habit of creating a MixIn class that gave a lot of common functionality across all of our content classes. Stuff like common URL creation schemes, membership-level checking functions, etc. etc.
Since we used a very consistent naming scheme across all of our models, this approximates an ABC, but it’s just Good Old Python. A model declaration would look like: