tags:

views:

425

answers:

1

I'm new to Django and so far I like it a lot but I've come to a bit of a roadblock and I'm not sure if it is in the admin that I can change this, or in my models. I have a relationship that looks like this: Unfortunately due to circumstances I can't link the actual code

class A:

class B:
    a = models.ForeignKey(A)

class C:
    a = models.ForeignKey(A)

class D:
    b = models.ForeignKey(B)
    c = models.ForeignKey(C)

When i run admin I get a nice selection list for class "C" when creating rows of "D". The admin has "D" as a inline of "B", so "B" is populated. The problem is the selection list for "C" is ALL instances of "C", what I'd like is that when I want to edit "B", and its related "D", that only instances of "C" that are tied to "A". Ok, I hope that wasn't too confusing. Thanks!

A: 

You will most likely need to inject a custom widget for this.

TokenMacGuy