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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:28:40+00:00 2026-06-13T14:28:40+00:00

I have a sorted list of objects that I want my users to select

  • 0

I have a sorted list of objects that I want my users to select a range from. For this I added two select elements (called from and to)to my web page. from is filled directly from the list, like this:

<select id="from">
    {% for el in el_list %}<option>{{el.number}}</option>{% endfor %}
</select>

Once a value has been selected in from I’d like to populate to with the values from the selected value until the last one.

The list is sorted by the number attribute on python’s side so I guess all I need to do is find the selected element in the list, slice the list accordingly and use the rest to populate my second select.

I’ve searched the documentation and several snippets but so far I’ve only found filters giving me the last or the first element of a list. I also know I can check if the selected value is in my list using in, but how can I then get that object’s index?

I know I could probably run along the whole list with a for … if, but I am almost sure there’s a more elegant method out there, that I simply haven’t found yet.

If any of you could provide me with a few pointers on how to solve this more elegantly it’d be much appreciated.

  • 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-13T14:28:42+00:00Added an answer on June 13, 2026 at 2:28 pm

    I don’t know why you’re looking through template tags for this. They won’t help: by the time the user sees the page to select something from the from select, the template has already been rendered. You need to use Javascript.

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

Sidebar

Related Questions

I have a list of objects, that are pre-sorted based on some complex criteria
I have an ordered (i.e. sorted) list that contains dates sorted (as datetime objects)
Okay suppose I have an array of objects that look like this: obj(from, to)
I have one List of objects that looks somthing like this class Item {
I have a stl::list containing Widget class objects. They need to be sorted according
I have sorted list of strings that I move between php and java. to
def sortProfiles(p): return sorted(p, key=itemgetter('first_name')) I have a list with dictionaries. This function allows
Here's a strange question for you guys, I have a nice sorted list that
I have a sorted map and want to reference its ordered objects by their
I want to annotate a list of objects (which each have a set of

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.