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

  • Home
  • SEARCH
  • 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 8836441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:29:44+00:00 2026-06-14T09:29:44+00:00

Possible Duplicate: How do you retrieve items from a dictionary in the order that

  • 0

Possible Duplicate:
How do you retrieve items from a dictionary in the order that they’re inserted?

I have an issue with django view and template

After getting details related to a meeting like

        for meeting in get_meetings:
           if meeting.venue_id ==None:
                 mee_data = {} 
                 mee_data['id'] = meeting.id
                 getdate = meeting.meeting_datetime
                 mee_data['date'] = getdate.strftime("%Y-%m-%d")
                 mee_data['end_time'] = meeting.end_time
                 mee_data['meeting_duration'] = meeting.meeting_duration 
                 mee_data['start_time'] = meeting.start_time 
                 mee_data['meetingID'] = meeting.meetingID
                 mee_data['id'] = meeting.id
                 mee_data['start_time'] = meeting.start_time 

                 mee_data['name'] = meeting.name

                 getall.append(mee_data) 

Where getall is a list i have declared above

Now after appending the dictionary data.

I am expecting the result in my template is like

[{"id": "REG_431103567", "date": "", "end_time": "", "meeting_duration": "", "start_time": "2012-10-29", "meetingID": 192dnjd, "name": "TEsts"},...]

basically the order of keys but unfortunately the result is coming like .

[{"meetingID": "REG_431103567", "start_time": "", "meeting_duration": "", "end_time": "", "date": "2012-10-29", "id": 192, "name": "TEsts"},...]

Please suggest me what should i do here so that i could get the keys and their corresponding values in proper way .

Thanks

  • 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-06-14T09:29:45+00:00Added an answer on June 14, 2026 at 9:29 am

    I’d suggest use an OrderedDict to get the data in the order it was inserted.

    Dictionaries don’t maintain the order but an OrderedDict which is a sub-class 0f dict can maintain the order.

    Example:

    >>> from collections import OrderedDict
    >>> d=OrderedDict()
    >>> d["key1"]="foo"
    >>> d["key2"]="bar"
    >>> d
    OrderedDict([('key1', 'foo'), ('key2', 'bar')])
    

    Note: OrderedDict was introduced in python 2.7, so will not work in previous versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: MySQL retrieve latest record for Group I have a query that groups
Possible Duplicate: Retrieve column names from java.sql.ResultSet I have query which returns the result
Possible Duplicate: Asynchronous HTTP calls in Python I have a Django view which needs
Possible Duplicate: Python: Retrieve items from a set Consider the following code: >>> item1
Possible Duplicate: Retrieve (or simulate) full query from PDO prepared statement I can't figure
Possible Duplicate: First items in inner list efficiently as possible Lets say I have:
Possible Duplicate: Retrieve JIT output Generating Assembly from C# code? I started to learn
Possible Duplicate: How can i retrieve a table from stored procedure to a datatable
Possible Duplicate: How do I get the nth element from a Dictionary? If there's
Possible Duplicate: Can I retrieve an ipad unique device identifier that through Safari with

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.