def create_bookmarks(instance): """Creates a new bookmarks list for the given object. """ from djangoerp.core.cache import LoggedInUserCache logged_cache = LoggedInUserCache() current_user = logged_cache.user if isinstance(instance, get_user_model()): logged_cache.user = instance kls = instance.__class__ bookmarks, is_new = Menu.objects.get_or_create(slug=get_bookmarks_slug_for(instance), description="Bookmarks for %s:%s" % (kls.__name__, instance.pk)) logged_cache.user = current_user return bookmarks, is_new
def create_dashboard(sender, instance, *args, **kwargs): """Creates a new dashboard for the given object. """ from djangoerp.core.cache import LoggedInUserCache logged_cache = LoggedInUserCache() current_user = logged_cache.user if isinstance(instance, get_user_model()): logged_cache.user = instance model_ct = ContentType.objects.get_for_model(cls) dashboard, is_new = Region.objects.get_or_create( slug="%s_%d_dashboard" % (model_ct.model, instance.pk), title=default_title, content_type=model_ct, object_id=instance.pk) logged_cache.user = current_user
def create_dashboard(sender, instance, *args, **kwargs): """Creates a new dashboard for the given object. """ from djangoerp.core.cache import LoggedInUserCache logged_cache = LoggedInUserCache() current_user = logged_cache.user if isinstance(instance, get_user_model()): logged_cache.user = instance model_ct = ContentType.objects.get_for_model(cls) dashboard, is_new = Region.objects.get_or_create( slug="%s_%d_dashboard" % (model_ct.model, instance.pk), title=default_title, content_type=model_ct, object_id=instance.pk ) logged_cache.user = current_user