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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:58:36+00:00 2026-05-21T14:58:36+00:00

I would like to have a custom snippet of html form code that takes

  • 0

I would like to have a custom snippet of html form code that takes allows the user to select a ‘training’ that is then used as a query parameter to a django-admin model filter for ‘participants’.

I’ve successfully created the filter on the modeladmin:

class ParticipantAdmin(RestrictedModelAdmin):
    list_filter = ('training__name',)

It’s probably worth noting that RestrictedModleAdmin is a subclass of ModelAdmin that provides row-level security for the model; logged in users should only see rows they own.

Thus, urls using this filter look something like this when just using that admin interface:

/admin/core/participant/?training__name=Menno+Ropes

All that works great. Now I think I should be able to create a very simple form that allows selecting a valid ‘training’ and submitting that to /admin/core/participant/ as a GET.

<form method="GET" action="/admin/core/participant/">{% csrf_token %}
    <ol>
        <li>Select your training:
            <select name='training__name'>
                <option value=''>&mdash;</option>
                {% for training in trainings %}
                <option value='{{ training.name }}'>{{ training }}</option>
                {% endfor %}
            </select>
        </li>
        <li>See participants for that training.
            <input type='submit' name='submit' value='Submit' /></li>
    </ol>
</form>

This last bit doesn’t see to work. Some magic foo in the django innards seems to always mangle the submission to be:

/admin/core/participant/?e=1

This obviously doesn’t select the appropriate filter value and thus shows an unfiltered list of ‘participants’.

What’s going on? What can I do to get it to allow my GET parameter to pass through to the admin model?

Thanks in advance.

PS) Django 1.3+

  • 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-21T14:58:37+00:00Added an answer on May 21, 2026 at 2:58 pm

    The problem is that you have a name attribute in your <input type="submit">, causing an extra GET parameter: submit which is throwing the invalid lookup error and thus e=1

    Remove the name attribute and you’re good to go.

    I did a little experiment to confirm since I thought it odd that the server might somehow treat a browser GET differently.

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

Sidebar

Related Questions

I have a custom-made view that extends the View class. I would like 2
I have authored some custom classes that I would like to create using XAML:
hi i would like to create a custom calendar, this calendar will have custom
I would like to have an app include a custom font for rendering text,
I'm writing a custom blog engine and would like to have trackbacks similar to
I'm writing a custom ASP.NET webcontrol and would like it to have a collection
I have a list of custom objects List and I would like to update
I have a web service method where I would like to throw some custom
I have a .NET deployment project. I would like to add a custom uninstall
I have a problem that I would like have solved via a SQL query.

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.