On Fri, 2009-05-22 at 10:36 -0700, shadfc wrote:
> I've got a few classes that inherit from an abstract class.  At some
> point, I want to check and make sure that an object is an instance of
> the base class, but this always seems to fail. I've posted what I know
> and what I think may be relevant below.
> 
> Is isinstance() not matching because the RequisitionOrderItem.__mro__
> classes have decotrack (my project) prepended, while OrderItem does
> not?   Why is this?  They come from the same models.py

Your suspicion is correct; your models module is being loaded more
than once. Since django registers non-abstract model classes,
RequisitionOrderItem always refers to the same class. This isn't true
for OrderItem, because django doesn't register abstract model classes.

Rather than trying to make isinstance work in this case, it would
probably be better not to use isinstance.

sdc



--~--~---------~--~----~------------~-------~--~----~
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