Opened 17 years ago

Closed 17 years ago

#5488 closed (fixed)

newforms-admin: inline fields with multiple fk's between models doesn't work

Reported by: jdetaeye Owned by: jdetaeye
Component: contrib.admin Version: newforms-admin
Severity: Keywords: newforms-admin: inline
Cc: jdetaeye@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In case a single foreign key relation exists between the inline model and its parent, all is fine.
When there are multiple keys between the models, the InlineModelAdmin class provides the field fk_name in which we can define which one to use.

The required lookup when the fk_name is specified has not been coded yet: forgotten or skipped-for-now.
The attached patch provides the implementation.

Attachments (1)

newforms_admin_inline.patch (4.1 KB ) - added by jdetaeye 17 years ago.
implementation patch

Download all attachments as: .zip

Change History (6)

by jdetaeye, 17 years ago

Attachment: newforms_admin_inline.patch added

implementation patch

comment:1 by jdetaeye, 17 years ago

The real changes in the patch are in lines 326-333 only.
Changes in other lines are trailing spaces removed by my source editor...

comment:2 by Nicola Larosa, 17 years ago

Do you really mean this does not need tests? :-) I'd like to supply them, otherwise (if I manage to discover what's the new syntax for inline fields).

Oh, and would you please add your email to the ticket? It would be nice to be able to contact you directly. Thanks.

comment:3 by jdetaeye, 17 years ago

Cc: jdetaeye@… added

if I manage to discover what's the new syntax for inline fields

I share your frustration.
Here's what I figured out:

class Child_Inline(admin.TabularInline):
  model = Child
  extra = 3

class Parent_admin(admin.ModelAdmin):
  inlines = [Child_Inline]

comment:4 by jkocherhans, 17 years ago

Triage Stage: UnreviewedAccepted

Marked #5358 as a duplicate.

comment:5 by jkocherhans, 17 years ago

Resolution: fixed
Status: newclosed

(In [6301]) newforms-admin: Fixed #5488. inlines with multiple ForeignKeys to the same parent don't work. Thanks jdetaeye. Also, some whitespace cleanup. Sorry for the mess.

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