Exemple #1
0
def get_user_list(user_list):
    new_user_list = []
    for user in user_list:
        profile = user.get_profile()
        if profile:
            new_user_list.append(get_location_dict(profile, 'user'))
    return new_user_list
Exemple #2
0
def get_app_member_list(hub):
    hub_queryset = (hub.hubappmembership_set
                    .select_related('application').all())
    apps_member_list = []
    for membership in hub_queryset:
        app = membership.application
        apps_member_list.append(get_location_dict(app, 'app-member'))
    return apps_member_list
Exemple #3
0
def get_organization_list(user_list):
    new_org_list = []
    for user in user_list:
        org_list = (user.organizationmember_set
                    .select_related('organization').all().distinct())
        for membership in org_list:
            org = membership.organization
            new_org_list.append(get_location_dict(org, 'organization'))
    return new_org_list
Exemple #4
0
def hub_locations_json(request, slug):
    hub = get_object_or_404(Hub.active, slug__exact=slug)
    raw_user_list = get_users(hub)
    # Get events with location
    item_list = get_event_list(hub)
    hub_dict = get_location_dict(hub, 'community')
    if hub_dict:
        item_list += [hub_dict]
    item_list += get_user_list(raw_user_list)
    item_list += get_organization_list(raw_user_list)
    item_list += get_app_member_list(hub)
    return json_response(item_list, callback='map.render')
Exemple #5
0
def testbed_locations_json(request, slug):
    testbed = get_object_or_404(Testbed.active, slug__exact=slug)
    item_list =[get_location_dict(testbed, 'testbed')]
    item_list += get_app_list(testbed)
    return json_response(item_list, callback='map.render')
Exemple #6
0
def get_app_list(testbed):
    return [get_location_dict(a, 'app') for a in testbed.applications.all()]
Exemple #7
0
def get_event_list(hub):
    event_list = []
    for event in Event.published.get_upcoming(hubs=hub):
        if event.position.longitude and event.position.latitude:
            event_list.append(get_location_dict(event, 'event'))
    return event_list