I'm stuck on creating a custom widget for the admin interface and  
wondering if anyone can help on where to look.

I've got a field which is essential a ForeignKey pointing to a State  
model. In the admin interface I would like to show the current state  
(done) and a list of the possible transitions (where I'm stuck). The  
list of the possible transitions is the issue since this is based on  
the attributes of the current State AND the current values of the  
model instance.

On the state I've got a method:

        def get_transitions(self, obj):
                ...

Which given the model instance, will combine and figure out the  
possible transitions. But I'm not sure how to get the required object.

I've been rummaging around in  
django.db.models.fields.related.ForeignKey > formfield, there's an  
option to set the queryset. For example for a foreign key, it uses the  
default object manage of the class the reference is pointing to. But  
at that point I don't have the model instance to pass to  
get_transitions.

If I go up to the widget I don't have access to the model instance at  
all.

I've wandered around object managers and I'm a bit stumped. Any ideas  
appreciated, I have a feeling I'm going about it all wrong (wouldn't  
be the first or last time :).

Thanks
--
   Andy McKay
   Site: www.clearwind.ca
   Blog: www.agmweb.ca/blog/andy






--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to