Friday 15 August 2014

python - How do I use a complex context with Django? -


I'm learning the Jaguar by creating a simple contact manager,
I am using Django 1.7.3 with Python 2.7 I use
I'm confused about how to present the template with reference.

  context = {'name': 'John doe', 'age': 24, 'email_ids': [' Use ':' personal ',' email ':' johndoe @ Example.com '}, {' Usage ':' Work ',' Email ':' manager@example.com '}, {' Use ':' 'Use' ':' Work ':' Spam ',' Email ':' iwantyournewsletter@example.com '}] [' 'phone' ':' personal ',' number ':' +1234567890 ',' number ':' +1234567891 '}]}}  

I do not know how inside the list (email description and description of the number) Cast ( Imel_ds and in the context of phone ), while I put the name and age.

In Python I ['email_ids'] for email in context: email ('[email_ids'])

> Is it the equivalent in the demo template, to print e-mail?

How do I insert an email address in the respective area?

{% use%} template tag and key in each dictionary Dot notation, ez:

  email address for email id {email_id.use}}: {{Email_id.email}} {% endfor%}  

No comments:

Post a Comment