示例#1
0
def show(request, sync_id):
    from webinars_web.webinars import models as wm
    account_sync = wm.AccountSync.objects.select_related('account','account__hub').get(pk=sync_id)

    events_hash = dict((e.id,e) for e in account_sync.account.events)
    event_syncs_hash = dict((es.id, es) for es in account_sync.event_syncs)
    d = {}
    for es in event_syncs_hash.values():
        es.webex_stages = []
        es.gtw_stages = []
        es.shards = []
        es.parent = account_sync
        es.event = events_hash[es.event_id]
        d[es.id] = {}
    for s in wm.WebexEventSyncStage.objects.filter(parent_sync__parent=account_sync):
        event_syncs_hash[s.parent_sync.id].webex_stages.append(s)
        s.parent_sync = event_syncs_hash[s.parent_sync.id]
    for s in wm.GTWEventSyncStage.objects.filter(parent_sync__parent=account_sync):
        event_syncs_hash[s.parent_sync.id].gtw_stages.append(s)
        s.parent_sync = event_syncs_hash[s.parent_sync.id]
    for s in wm.EventSyncShard.objects.filter(parent_sync__parent=account_sync):
        event_syncs_hash[s.parent_sync.id].shards.append(s)
        s.parent_sync = event_syncs_hash[s.parent_sync.id]
    for s in wm.HubSpotEventSyncStage.objects.filter(parent_sync__parent=account_sync).select_related('parent_sync','event_form','event_form__cms_form').order_by('start_last_modified_at','offset'):
        d[s.parent_sync.id].setdefault(s.event_form.cms_form,[]).append(s)
    for es in event_syncs_hash.values():
        es.hubspot_stages_cmsforms = [(v,k) for k,v in d[es.id].iteritems()]

    return syncs._show(request, 'account', account_sync)
示例#2
0
def show(request, sync_id):
    from webinars_web.webinars import models as wm
    return syncs._show(request, 'hub', wm.HubSync.objects.select_related('hub').get(pk=sync_id))