Also, any change in the Link from_hub or to_hub will result in the
form being reloaded so no need to change the dropdown lists after
being loaded....

On Oct 8, 9:22 am, sico <allensi...@gmail.com> wrote:
> by the way, I'm using django 1.0.2 ....  but am not against upgrading
> if it helps me solve this problem!
>
> On Oct 7, 3:36 pm,sico<allensi...@gmail.com> wrote:
>
> > Suppose I have 4 models as below:
>
> > class Hub(models.Model):
> >     name = models.CharField("Name", )
> >     something-else = models.CharField("Something", )
>
> > class HubPlug(model.Model):
> >     hub = models.ForeignKey(Hub)
> >     plug_id = models.CharField("Plug Id (A, B, C, etc)", )
>
> > class Link(model.Model):
> >     from_hub = models.ForeignKey(Hub, related_name =
> > "link_from_hub", )
> >     to_hub = models.ForeignKey(Hub, related_name = "link_to_hub", )
> >     link_type = models.CharField("Link Type", )
>
> > class LinkDetail(model.Model):
> >     link = models.ForeignKey(Link)
> >     from_plug = models.ForeignKey(HubPlug, related_name =
> > "link_from_plug", )
> >     from_plug_type = models.CharField("From Plug Type", )
> >     to_plug = models.ForeignKey(HubPlug, related_name =
> > "link_to_plug", )
> >     to_plug_type = models.CharField("To Plug Type", )
>
> > now, I have an admin form for Link that shows the Link Details as
> > Tabular Inline:
>
> > class LinkDetailInline(admin.TabularInline):
> >     model = LinkDetail
> >     extra = 3
>
> > class LinkAdmin(admin.ModelAdmin):
> >     inlines = [
> >         LinkDetailInline,
> >     ]
>
> > admin.site.register(Link, LinkAdmin)
>
> > The dropdowns for the from_plug to to_plug show all plugs and I'd like
> > them to just show the plugs for the respective from_hub/to_hub.
>
> > I'm guessing this would have to happen in the LinkAdmin class
> > somewhere, but where!!
>
> > thanks in advance,
> > Simon
>
> > p.s. would also be nice to only show those plugs that aren't in use
> > now but that should be easy once the above is sorted!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to