Code

Opened 7 years ago

Closed 7 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: UI/UX:

Description

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')
        CATS={}
        for c in cats:

            if (portfolio in c.get_p_list()) or (c == portfolio):
                CATS[c.title]=c
        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

Attachments (0)

Change History (1)

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.