[Answered ]-Creating parent model that all models will inherit from in Django

2👍

It looks like you’re trying to insert an abstract base class for your models.

Basically, what you’ve got there is correct, except you’re missing

from django.db.models import Model
class MyModelBase(Model):
     class Meta:
         abstract = True

     # ... The fields and methods I want all my models to inherit.

Then rather than making your models inherit from django.db.models.Model, they should inherit from MyModelBase.

Leave a comment