How to format data for a django template?
<p>This is a sample of my data:</p>

<pre class="lang-none prettyprint-override"><code>Network Policy
    Level 1: John Smith
    Start date: 27 April
    Start time: 8am
    end Date: 05 May
    end time: 8am
    Level 2: Bob Smith
    Start date: 27 April
    Start time: 8am
    end Date: 05 May
    end time: 8am
Server Policy
    Level 1: Jane Doe
    Start date: 23 April
    Start time: 8am
    end Date: 02 May
    end time: 8am
    Level 2: Greg Brad
    Start date: 23 April
    Start time: 8am
    end Date: 02 May
    end time: 8am
</code></pre>

<p>I need to arrange this data in such a format that I can use it as a template in django. I thought I needed nested dictionaries at first, but that doesn't work, as I need multiple values under the same Key.</p>

<p>I'm new to Python, so please correct the above if I'm wrong.</p>

<p>EDIT:</p>

<p>this is as far as ive got, </p>

<p>i have Dict > list , not sure how to get a dict into the list though that matches?</p>

<pre><code>### Get all the Polices ###
dictContext = {}
for objPolicy in objPolicyData['escalation_policies']:
    strPolicyName = objPolicy['name']   
    if strPolicyName.lower().find('test') == -1:
        lstLevel = []
        dictContext[strPolicyName] = lstLevel
        for objOnCall in objPolicy['on_call']:
            dictUser = {}
            lstLevel.append(objOnCall['level'])
            dictUser['strStartDate'] =  getDate(objOnCall['start'])
            dictUser['strStartTime'] = getTime(objOnCall['start'])
            dictUser['strEndDate'] =  getDate(objOnCall['end'])
            dictUser['strEndTime'] = getTime(objOnCall['end'])
            objUser = objOnCall['user']
            dictUser['strUsername'] =  objUser['name']
            dictUser['strUserMobile'] = getUserMobile(objUser['id'])
            #lstLevel.append(dictUser)
</code></pre>

<p>result is</p>

<pre><code>{
    u'DBA Escalation Policy': [1],
    u'Server Escalation Policy': [1],
    u'Network Team Escalation Policy': [1, 2],
    }
</code></pre>

<p>so my next step is to have the user details under each level</p>

<p>it needs to go </p>

<pre><code>Policy1 &gt; Level 1 &gt; level 1 user details | Level 2 &gt; Level 2 user details
Policy2 &gt; Level 1 &gt; level 1 user details 
Policy3 &gt; Level 1 &gt; level 1 user details | Level 2 &gt; Level 2 user details | Level 3 &gt; Level 3 user details
</code></pre>

<p>this is my goal</p>

<p>Thanks</p>