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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:16:22+00:00 2026-05-12T19:16:22+00:00

I am building an article site using django. I’ve added many to many relation

  • 0

I am building an article site using django.
I’ve added many to many relation between my articles this way:

class Article (models.Model):
    # Tiny url
    url = models.CharField(max_length = 30, unique=True)
    is_published = models.BooleanField()
    author = models.CharField(max_length = 150)
    title = models.CharField(max_length = 200)
    short_description = models.TextField(max_length = 600)
    body = tinymce_models.HTMLField()
    related = models.ManyToManyField("self")

Now in my admin site, I see multiple select box ( see image here http://img.skitch.com/20091017-mfs2mbhbuudk2rgquium1bu61d.png)

What I want is to use this box usable for a user who will chose articles to bind them to a current one. So for example, is there a way to add some filtering there? E.g. If I would like to filter all articles by section? And then dismiss previous results and filter the whole set by name, etc?

Thanks in advance

+++

I am trying to investigate possibility to add filter horizontal to admin. But after I added it this way:

class ArticleAdmin(admin.ModelAdmin):
    exclude = ('video', )

    js = ('/site_media/js/tiny_mce/tiny_mce.js', 
          )
    list_display = ('title', 'author', 'section', 'is_published', 'pub_date')
    list_filter = ('author', 'section', 'is_published', 'pub_date')
    filter_horizontal = ['related', ]
    search_fields = ['body', 'title', 'short_description', 'seo_keywords']

All articles vanished from admin 🙁

  • 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-12T19:16:23+00:00Added an answer on May 12, 2026 at 7:16 pm

    If you look for basic filtering, try this or that:

    If you want to customize filtering, you could actually do it. A little guide:

    Subclass forms.SelectMultiple or directly the existing FilteredSelectMultiple from django.contrib.admin.widgets and make it do what you want.

    Then subclass ModelAdmin in your admin.py and overwrite formfield_for_manytomany (look in django.contrib.admin.options for that method) and exchange the existing widget with your new one.

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

Sidebar

Related Questions

Let's say I'm building an Article / Comment system like this: class Article(models.Model): title
I'm building a Windows service and following this MSDN article , but I'm stuck
I am building CLR Stored Procedures and UDFs as discussed in this article: http://www.codeproject.com/KB/cs/CLR_Stored_Procedure.aspx
So I'm building a blog engine which has /articles/then-the-article-permalink as it's URL structure. I
I am building a site for a magazine that includes three different sections- articles,
I'm building a Symfony application that's made to run many sites. Similar to this
I'm building a site that has three main types of online news publications: Article
I am building a php+mysql site which will have numerous articles. I am pretty
Does anyone know what is being used in this article ( Building an HTML5
I'm trying to build the search for a Django site I am building, 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.