#34789: Admin filter_horizontal shows item in "Chosen" column after being added
through a Foreign Key field of the same model.
-------------------------------+------------------------------------
     Reporter:  devin13cox     |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  contrib.admin  |                  Version:  4.2
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  1              |                    UI/UX:  1
-------------------------------+------------------------------------
Changes (by Natalia Bidart):

 * stage:  Unreviewed => Accepted


Comment:

 Replying to [comment:3 devin13cox]:
 > Of course, here is the model (reduced to the example):

 Great! Thank you.

 > While I don't think that the "Workflow" component (and Inline stacking)
 are relevant to this bug -- I kept them there to keep it as close to my
 current flow as possible. This should be able to be reproduced without the
 workflow element.

 Confirmed I was able to reproduce with a reduced example like this:

 {{{#!python
 from django.db import models


 class State(models.Model):
     label = models.CharField(max_length=255)

     def __str__(self):
         return self.label


 class Transition(models.Model):
     source = models.ManyToManyField(State,
 related_name="transition_source")
     target = models.ForeignKey(State, related_name="transition_target",
 on_delete=models.CASCADE)
 }}}

 {{{#!python
 from django.contrib import admin

 from .models import State, Transition


 class TransitionAdmin(admin.ModelAdmin):
     filter_horizontal = ['source']


 admin.site.register(State)
 admin.site.register(Transition, TransitionAdmin)
 }}}

 Would you like to prepare a patch?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34789#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018a1abbe055-6ac50d6f-7b12-40b2-b8f1-b4e0e47e2fb2-000000%40eu-central-1.amazonses.com.

Reply via email to