Django: Admin, adding some new filters to a multiple choice field -


I am creating an article site that is using the demo. I have added many to my relationships between my articles:

  class articles (models.Model): # tiny URL url = model Chargefield (max_long = 30, exclusive = 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 = Modal. Many people ("self")  

Now in my admin site, I see more than one selection box (see image here)

What I want is the use of this box useful for the user, then articles will be chosen to bind them for an existing one. For Dahrn, is there a way to add some filtering? Like if I want to filter all the articles by section? And then reject the previous results and filter the whole set from name, etc?

Thank you in advance

+++

I'm trying to check the possibility of adding filters to the horizontal but after that Like added:

ArticleAdmin (admin.modelAdmin): Exclude = ('video',) js = ('/site_media/js/tiny_mce/tiny_mce.js',) List_display = ( List_filter = ('author', 'block', 'uninterrupted', 'pb_date') 'filter_horizontal = [' related '] [search]' search_image ',' title ',' author ',' block ',' invisible '

Div class = "text-post" itemprop = "text">

If you have basic Filter Try to try to c, to:

If you want to customize filtering, you can actually do. :

django.contrib.admin.widgets to form class SelectionMultiple or directly select to filter and Do it what you want.

Then type sub-class ModelAdmin and formfield_for_manytomany in your admin.py ( View in django.contri

< / P>


Comments