Skip to content

Commit

Permalink
First commit for issue jazzband#341 - Warning if inerhit is set to Fa…
Browse files Browse the repository at this point in the history
…lse in an abstract class
  • Loading branch information
Simon Hlywa committed Oct 18, 2018
1 parent c8c6856 commit 804b84d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions simple_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import importlib
import threading
import uuid
import warnings

from django.apps import apps
from django.conf import settings
Expand Down Expand Up @@ -72,6 +73,9 @@ def contribute_to_class(self, cls, name):
models.signals.class_prepared.connect(self.finalize, weak=False)
self.add_extra_methods(cls)

if cls._meta.abstract and not self.inherit :
warnings.warn("Historical records added to abstract model without inherit=true", UserWarning)

def add_extra_methods(self, cls):
def save_without_historical_record(self, *args, **kwargs):
"""
Expand Down

0 comments on commit 804b84d

Please sign in to comment.