Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4053558
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:27:45+00:00 2026-05-20T14:27:45+00:00

How to access the dictionary value in django template? I want to get the

  • 0

How to access the dictionary value in django template? I want to get the value of the variable a actually

class Emp(models.Model):
  name = models.CharField(max_length=255, unique=True)
  address1 = models.CharField(max_length=255)

  def get_names(self):
    names = {}
    names_desc = {}
    nbl = {}
    names.update({'a' : 1})
    names_desc.update({'b' : 2})
    nbl.update({'names' : names,'names_desc' : names_desc})
    return nbl

emp is my object that i am passing to the template
Is it {{emp.get_names}}?? or {{emp.get_names.names.a}}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:27:46+00:00Added an answer on May 20, 2026 at 2:27 pm
    {{ emp.get_names.names.a }} will get you 1 in the template
    
    {{ emp.get_names.names }} will get you {'A':1} in the template
    
    {{ emp.get_names }} will get you {'names_desc': {'b': 2}, 'names': {'a': 1}} in the template
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's assume that I have following models: class ScoutBook(models.Model): troop = models.ForeignKey('Dictionary', limit_choices_to={'type' :
I have a string like this: user=u123;name=Test;lastname=User I want to get a dictionary for
I'm want to use either a hash table or a dictionary in my access
What are the access times for: Looking up a value in Dictionary Check whether
I created my own Dictionary class, based on the .NET Dictionary. Now I want
I have a Django View that constructs a dictionary to a template. I have
Very simple thing. I sometimes want to access urban dictionary but it is blocked
I have a Dictionary<int, int> in my class. How can I access both values
I have a static Dictionary class X { static Dictionary<string,string> MyDict {get { ...
In order to synchronise access to a Dictionary object in the ASP.NET cache, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.