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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:23:41+00:00 2026-05-25T00:23:41+00:00

I have one ManyToMany model that I am using for two fields on a

  • 0

I have one ManyToMany model that I am using for two fields on a Model:

class SomeModel(models.Model):
    deposit    = models.ManyToManyField(PaymentMethod, related_name="deposit")
    withdrawal = models.ManyToManyField(PaymentMethod, related_name="withdrawal")

Then in my admin file I have this:

class SomeModelAdmin(admin.ModelAdmin):
    list_filter = ('deposit', 'withdrawal',)

The only problem with this is that on the filter on the listing page (in the right column). It says “By Payment Method”, instead of “By Deposit” and “By Withdrawal”.

  • 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-25T00:23:42+00:00Added an answer on May 25, 2026 at 12:23 am

    This is a known bug:

    https://code.djangoproject.com/ticket/15221

    This is a workaround (for version 1.4). It’s ugly, but at least it’s not monkey patching:

    from django.contrib.admin import RelatedFieldListFilter
    from django.contrib.admin.util import get_model_from_relation
    
    class WorkAroundListFilter(RelatedFieldListFilter):
    
        def __init__(self, field, request, params, model, model_admin, field_path):
            super(RelatedFieldListFilter, self).__init__(
                field, request, params, model, model_admin, field_path)
    
            other_model = get_model_from_relation(field)
            self.lookup_title = field.verbose_name
            rel_name = other_model._meta.pk.name
            self.lookup_kwarg = '%s__%s__exact' % (self.field_path, rel_name)
            self.lookup_kwarg_isnull = '%s__isnull' % (self.field_path)
            self.lookup_val = request.GET.get(self.lookup_kwarg, None)
            self.lookup_val_isnull = request.GET.get(
                                          self.lookup_kwarg_isnull, None)
            self.lookup_choices = field.get_choices(include_blank=False)
            self.title = self.lookup_title
    
    
    class SomeModelAdmin(admin.ModelAdmin):
        list_filter = (
            ('deposit', WorkAroundListFilter), 
            ('withdrawal', WorkAroundListFilter),
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have two Models that have a manytomany relationship with a through model,
I have two objects that have a ManyToMany relationship with one another through a
I have three models: System_Contact System Contact_list The Contact_List model has two fields: contact
In one of my models I have a categories field that is a manytomany
I have a Video object with two ManyToMany fields. Each will contain a list
I have two models, EqTD (EquivalentTextDescription) and location. EqTD has a manytomany relation to
I have a ManyToMany relationship with one of my Models. On deleting a child,
My django model looks like this: class Entity(models.Model): name = models.CharField(max_length=40) examples = models.ManyToManyField(Example,
I have two classes with a ManyToMany relationship. I'd like to select one from
I have one many-to-many relationship in my model. There are two entities, Emergencies and

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.