from django.utils import timezone
from django.core.exceptions import PermissionDenied
import model_policy
+from model_autodeletion import ephemeral_models
try:
# This is a no-op if observer_disabled is set to 1 in the config file
@classmethod
def is_ephemeral(cls):
- return False
+ return cls in ephemeral_models
+
+ def getValidators(self):
+ """ primarily for REST API, return a dictionary of field names mapped
+ to lists of the type of validations that need to be applied to
+ those fields.
+ """
+ validators = {}
+ for field in self._meta.fields:
+ l = []
+ if field.blank==False:
+ l.append("notBlank")
+ validators[field.name] = l
+ return validators
+
+