예제 #1
0
def add_navlet(account, navlet, preferences=None):
    """Create new accountnavlet based on request data"""
    if preferences is None:
        preferences = {}
    accountnavlet = AccountNavlet(account=account, navlet=navlet)
    accountnavlet.column, accountnavlet.order = find_new_placement(account)

    default_preferences = get_default_preferences(
        get_navlet_from_name(navlet)) or {}
    accountnavlet.preferences = dict(preferences.items() +
                                     default_preferences.items())
    accountnavlet.save()
    return accountnavlet
예제 #2
0
def add_navlet(account, navlet, preferences=None):
    """Create new accountnavlet based on request data"""
    if preferences is None:
        preferences = {}
    accountnavlet = AccountNavlet(account=account, navlet=navlet)
    accountnavlet.column, accountnavlet.order = find_new_placement(account)

    default_preferences = get_default_preferences(
        get_navlet_from_name(navlet)) or {}
    accountnavlet.preferences = dict(preferences.items() +
                                     default_preferences.items())
    accountnavlet.save()
    return accountnavlet
예제 #3
0
파일: __init__.py 프로젝트: hmpf/nav
def add_navlet(account, navlet, preferences=None, dashboard=None):
    """Create new accountnavlet based on request data"""
    if preferences is None:
        preferences = {}
    if dashboard is None:
        dashboard = AccountDashboard.objects.get(account=account, is_default=True)

    accountnavlet = AccountNavlet(account=account, navlet=navlet, dashboard=dashboard)
    accountnavlet.column, accountnavlet.order = find_new_placement()

    accountnavlet.preferences = (
        get_default_preferences(get_navlet_from_name(navlet)) or {}
    )
    accountnavlet.preferences.update(preferences)

    accountnavlet.save()
    return accountnavlet
예제 #4
0
파일: __init__.py 프로젝트: plan1230/nav
def remove_navlet(account, request):
    """Remove accountnavlet based on request data"""
    navlet_id = int(request.POST.get('navletid'))
    accountnavlet = AccountNavlet(pk=navlet_id, account=account)
    accountnavlet.delete()
예제 #5
0
def remove_navlet(account, request):
    """Remove accountnavlet based on request data"""
    navlet_id = int(request.POST.get('navletid'))
    accountnavlet = AccountNavlet(pk=navlet_id, account=account)
    accountnavlet.delete()