Opened 13 years ago

Closed 13 years ago

#6044 closed (wontfix)

limit_choices_to in one class disable edit_inline of a second in a third class

Reported by: anonymous Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: limit_choices_to, edit_inline
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have 4 classes: A,B, AImage and BImge. All inherit from models.Model
In AImage I have

item = models.ForeignKey(A, edit_inline=models.TABULAR, num_in_admin=6)

and in BImage

item = models.ForeignKey(B, edit_inline=models.TABULAR, num_in_admin=6)

Now I add to B

def adder():
        cats = A.objects.all()
        portfolio = A.objects.get(slug='something')
        for c in cats:

            if (portfolio in c.get_p_list()) or (c == portfolio):
        return CATS
    a_item = models.ForeignKey(a, limit_choices_to = {'title__in':adder()})

The result: AImage won't appear in A's admin screen. If limit_choices_to is not used in B, A will be shown correctly

Change History (1)

comment:1 Changed 13 years ago by Karen Tracey <kmtracey@…>

Resolution: wontfix
Status: newclosed

I don't believe any effort is going into fixing problems with old admin since the future of admin is the newforms-admin branch. FWIW, I cannot recreate this problem using the newforms-admin branch, so one option for you would be to try out the branch. Beware there are open bugs with that branch & edit-inline (see especially #5828, #5919, #5895), but I have been able to get by OK with newforms-admin and the patches from those tickets.

Note: See TracTickets for help on using tickets.
Back to Top