예제 #1
0
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
예제 #2
0
def unregister(model_cls):
    from eav.registry import Registry

    Registry.unregister(model_cls)
예제 #3
0
def register(model_cls, config_cls=None):
    from eav.registry import Registry

    Registry.register(model_cls, config_cls)
예제 #4
0
def unregister(model_cls):
    from eav.registry import Registry
    Registry.unregister(model_cls)
예제 #5
0
def register(model_cls, config_cls=None):
    from eav.registry import Registry
    Registry.register(model_cls, config_cls)
예제 #6
0
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)