[Answered ]-Django – same abstract base model for all models? Good, bad?

2πŸ‘

βœ…

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:

class SomeModel(models.Model, MixInClass):
    pass
πŸ‘€Peter Rowell

Leave a comment