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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:03:50+00:00 2026-05-22T23:03:50+00:00

I want people to be able to sort things and not just me sorting

  • 0

I want people to be able to sort things and not just me sorting things manually. So, for example, I will have a link to sorting, and the link will be something like, /?sort=issues and this would show a list of issues in alphabetical order, etc. Or /?sort=cover and it will show a list of issues with covers only.

Views.py

def issues(request):
    issues_list = Issue.objects.order_by('-date_added')
    paginator = Paginator(issues_list, 24)
    try:
        page = int(request.GET.get('page', '1'))
    except ValueError:
        page = 1
    try:
        issues = paginator.page(page)
    except (EmptyPage, InvalidPage):
        issues = paginator.page(paginator.num_pages)
    return render_to_response('comics/issues.html', {'issues': issues}, context_instance=RequestContext(request))

So, I’d want anyone to have the option of ordering by something like -date_added, date_addded, pub_date, importance, etc.

I’d imagine I’d have to fix my views and do some request.GET magic, but I am pretty new to Django and don’t really know how to go about doing this. I checked Django docs, too.

  • 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-22T23:03:51+00:00Added an answer on May 22, 2026 at 11:03 pm
    sort_by = request.GET.get('sort', '-date_added')
    if sort_by not in ['-date_added', 'date_addded', 'pub_date', 'importance']:
         sort_by = '-date_added'
    issues_list = Issue.objects.order_by(sort_by)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written an assembly I don't want other people to be able to
I want people to click on a link (generated from an asp:HyperlinkField) and have
I don't want people to be able to find all of my code just
I do not want to have a submit button as I want people to
I have a class that should look something like this: class Family_Type1 @people =
I have an RSVP box on my website where I want people to click
I have created an iframe code that I want people to use as a
The marketing people want to have the ability to write direct inline HTML in
I have a desktop written with Winforms. Now I have requests that people want
i have a wordpress blog and want to give people the same user experience

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.