def register(model_cls): Registry.register(model_cls, TimesinkEavConfig) for n in model_cls._meta.fields: if not n.startswith("_"): Attribute.objects.get_or_create(name=n+"_timestamp", datatype=Attribute.TYPE_DATE) model_cls.add_to_class("_createdAt", models.DateTimeField(auto_now_add=True)) model_cls.add_to_class("_modifiedAt", models.DateTimeField(auto_now=True)) model_cls.add_to_class("_deletedAt", models.DateTimeField(editable=False, blank=True)) return model_cls
def unregister(model_cls): from eav.registry import Registry Registry.unregister(model_cls)
def register(model_cls, config_cls=None): from eav.registry import Registry Registry.register(model_cls, config_cls)
def register(model_cls, config_cls=None, filter_by_parent=False): from eav.registry import Registry Registry.register(model_cls, config_cls, filter_by_parent)