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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:32:19+00:00 2026-06-02T20:32:19+00:00

I have this code in my django template: {%for client in clients %} {%

  • 0

I have this code in my django template:

{%for client in clients %}
    {% regroup books by com_name as com_name_list %}
       {% for com_name in com_name_list %}
            <tr>
            <td>
            <h3>{{ com_name.grouper }}</h3>
            </td>                                           
            </tr>
            {% for book in com_name.list %}
                {%if client.client.id == book.client.id %}
            <tr>
            <td></td>
            <td>
            {{book.id}}
            </td>
            <td>{{ book.created }}</td>
            <td>
            {% if client.client.b_type == 'ticketing'%}
                {{ book.date_select }}
            {% endif %}
            {% if client.client.b_type == 'hotel'%}
                {{ book.check_in }} - {{ book.check_out }}
            {% endif %}
            </td>
            <td>{{ book.last_name }}, {{ book.first_name }}</td>
            <td>{{ book.product }}</td>
            <td>{{ book.quantity }}</td>
                <td>{{ book.totalcost_rate|floatformat:2|intcomma }}</td>                                          <td>{{ book.status }} {{book.com_name}}</td>
             </tr>
            {%endif%}
        {% endfor %}
    {% endfor %}
{%endfor%}

but i was wondering why the output is this:

Partner ID  Transaction Date    Booking Date              Guest Name    Product        Qty  Amount          Status
test
        2   April 19, 2012   April 1, 2012 - April 2, 2012    hjb, jbh  Dormitory Room  1   1,000.00    Complete test
        3   April 19, 2012   April 10, 2012 - April 11, 2012  KJNJK, hbk    Dormitory Room  1   1,000.00    Complete test
direct h
        4   April 19, 2012   April 19, 2012 - April 20, 2012  HBH, JGVJ Dormitory Room  1   1,000.00    Complete direct h
        5   April 19, 2012   April 9, 2012 - April 10, 2012   kjnkj, njkjn  g           1   1,000.00    Complete direct h
test
        9   April 27, 2012   May 1, 2012 - May 2, 2012    ljnd, asdf    Dormitory Room  1   1,000.00    Complete test
       10   April 27, 2012   April 27, 2012 - April 28, 2012  jhbjh, dsjg   Dormitory Room  1   1,000.00    Complete test
       11   April 28, 2012   April 9, 2012 - April 10, 2012   jnj, asjn Dormitory Room  1   1,000.00    Complete test
       12   April 28, 2012   April 11, 2012 - April 12, 2012  jnj, jjn  Dormitory Room  1   1,000.00    Complete test

is my regroup is incorrect?
what should i do so that i can group it like this.

Partner ID  Transaction Date    Booking Date              Guest Name    Product        Qty  Amount          Status
test
        2   April 19, 2012   April 1, 2012 - April 2, 2012    hjb, jbh  Dormitory Room  1   1,000.00    Complete test
        3   April 19, 2012   April 10, 2012 - April 11, 2012  KJNJK, hbk    Dormitory Room  1   1,000.00    Complete test
        9   April 27, 2012   May 1, 2012 - May 2, 2012    ljnd, asdf    Dormitory Room  1   1,000.00    Complete test
       10   April 27, 2012   April 27, 2012 - April 28, 2012  jhbjh, dsjg   Dormitory Room  1   1,000.00    Complete test
       11   April 28, 2012   April 9, 2012 - April 10, 2012   jnj, asjn Dormitory Room  1   1,000.00    Complete test
       12   April 28, 2012   April 11, 2012 - April 12, 2012  jnj, jjn  Dormitory Room  1   1,000.00    Complete test

direct h
        4   April 19, 2012   April 19, 2012 - April 20, 2012  HBH, JGVJ Dormitory Room  1   1,000.00    Complete direct h
        5   April 19, 2012   April 9, 2012 - April 10, 2012   kjnkj, njkjn  g           1   1,000.00    Complete direct h

can anyone can help me in my case? thanks in advance…

  • 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-02T20:32:21+00:00Added an answer on June 2, 2026 at 8:32 pm

    regroup doesn’t order its input. You have to order your list by com_name before passing it to regroup. The documentation explains this and gives an example.

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

Sidebar

Related Questions

I have this code in my forms.py : from django import forms from formfieldset.forms
I have this model in django: class JournalsGeneral(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code,
I have a django template which extends the base template that has code to
I have the following code in django.template: class Template(object): def __init__(self, template_string, origin=None, name='<Unknown
I have the following code in my Django template: <a href={% url myapp.views.myview foobar
UPDATE 1 ADDED UPDATED CODE I have a django template on app engine. Currently
I have a list of sections that I pass to a Django template. The
I currently have my Django custom template filter like this: from django import template
I have this code in my views.py: from django.http import HttpResponse, Http404 from django.shortcuts
I have this code for doing an ajax request to a webservice: var MyCode

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.