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 143487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:06:12+00:00 2026-05-11T08:06:12+00:00

I jumped into learning django recently. I am rendering my template with citylist like,

  • 0

I jumped into learning django recently.

I am rendering my template with citylist like,

{'citylist': Cities.objects.all()} 

And want to reqroup on country in template (same as in django-docs) below:

{% regroup citylist by country as coutrylist %}  <ul> {% for country in countrylist %}     <li>{{ country.grouper }}     <ul>         {% for c in country.list %}         <li>{{ c.name }}</li>         {% endfor %}     </ul>     </li> {% endfor %} </ul> 

but i get some unextpected results,

France   Strasbourg  Australia   Penrith   Sydney  US   Larsen Bay  France   Reims  US   Avenal 

I dont think i am doing something wrong in my template. Or its a bug??

  • 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. 2026-05-11T08:06:12+00:00Added an answer on May 11, 2026 at 8:06 am

    Problem is not in the code, but with data you are injecting in.

    Change your context to

    {'citylist': Cities.objects.all().order_by('country')} 

    django-docs mentions that

    The easiest solution to this gotcha is to make sure in your view code that the data is ordered according to how you want to display it.

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

Sidebar

Related Questions

I've recently jumped into the XNA pool, and am learning all the ins and
I have recently jumped into the world of jQuery. I saw the methods find()
I've only recently jumped into the world of iphone development and objective-c, so I'm
I just jumped into Git yesterday via Github and am moving away from svn.
I have just jumped into the Blackberry development arena... I am trying one example
I am very used to javascript and php programing, and I just jumped into
I have just jumped into Objective-C and I got stuck pretty early on. I
Say I have a string like this: $string = 'The /*quick*/ brown /*fox*/ jumped
In SQL server 2005 this query select len(cast('the quick brown fox jumped over the
<?php $string = 'The quick brown fox jumped over the lazy dog.'; $patterns[0] =

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.