@classmethod
def increment_counter(cls):
    with cls._counter_lock:
        cls._counter += 1

def some_action(self):
    self.increment_counter()
print(MyModel._counter)
Глобальные переменные Python Django