python - Dictionnary item with `.` in index -


मेरे पास यह शब्दावली है

  # Views.py परिणाम = {} # सामग्री प्रकार सेट करें परिणाम ["teams.team"] = [] परिणाम ["users.userprofile"] = [] sqs में परिणाम के लिए: content_type = result.content_type () # teams.team, users.userprofile, ... परिणाम [content_type] .append (result.get_additional_fields ()) # get_additional_fields = & gt; {title: "", ...}   

मैं कैसे एक django टेम्पलेट में teams.team आकार प्रदर्शित कर सकते हैं?
मैंने कोशिश की {{results.user.userprofile } लेकिन ऐसा लगता है कि गलत कर रहे हैं।

धन्यवाद

आपका शब्दकोश : नहीं = का उपयोग निम्नानुसार होगा:

  परिणाम = {" उपयोगकर्ता .userprofile ": {" title ":" the name "} ...}   

तब आप ऐसा कर सकते हैं:

  {{परिणाम ['उपयोगकर्ता .userprofile '] [' शीर्षक ']}}   

आपके अपडेट किए गए प्रश्न का उत्तर:

  {{लेन (परिणाम [' teams.team '] )}}    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -