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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:25:32+00:00 2026-06-16T01:25:32+00:00

I am trying to use custom search option in manytomany field for admin panel.

  • 0

I am trying to use custom search option in manytomany field for admin panel. It does not work my way. After search I want to show selected item as a list below the search field, currently it shows comma separated value in search field. Here my code

class MyModel(models.Model):
my_data= models.ManyToManyField(Topic, blank=True, null=True, related_name='mymodel_data')

admin.py

class MyModelCustom(admin.ModelAdmin):
model = MyModel
# define the raw_id_fields
raw_id_fields = ('my_data',)
# define the related_lookup_fields
related_lookup_fields = {
    'my_data': ['my_data']
}
admin.site.register(MyModel, MyModelCustom)

please help

  • 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-16T01:25:33+00:00Added an answer on June 16, 2026 at 1:25 am

    the related_lookup_fields in your ModelAdmin is wrong. It needs to be:

    related_lookup_fields = {
        'm2m' : ['my_data']
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create the custom search webpart. I want to use Enterprise
I am trying to use Google Custom Search (Business Edition) on my site. I
I'm trying to use Google's Custom Search API through the Google API Ruby client
I am trying to use Google Custom Search to provide search capabilities to an
Is there a way to search contents of a TreeListEx field in a custom
I'm trying to use my model with a replacement for the search (custom search
I am trying to use vqmod to implement a new custom field called 'Additional
I'm trying to use custom meta boxes in wordpress. My goal at the moment
I'm trying to use custom check boxes within Fancybox. They are showing up but
I am trying to use a custom segue to perform a kind of zoom

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.