Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
        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
Ejemplo n.º 4
0
 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