I am forgetting OOP terminology which was related to inheritance and which used classes dynamically. Here is what I am looking for.
@classmethod
def _match_slug(cls, slug):
""" Method that checks if we still have a match in the db for current 'slug' """
return cls.objects.filter(slug=slug).count()
I have 10 models in my application and each has this _match_slug method. I want to take this method to the parent class, so when I call self._match_slug(slug_to_check) it calls the method with its appropriate class cls.
Thoughts?
class MyModel(Parent):