Hi, I am not sure if this is possible but it would really help if it
is.

I have 4 classes

class CF(models.Model):
    ....

class CFT(CF):
    data = models.CharField(max_length=20)

class CFI(CF):
    data = models.IntegerField()

class Doc(models.Model):
    name = models.CharField(max_length = 40)
    cf = models.ManyToManyField(CF, null = True)

I create a new Doc

doc = Doc(name = 'x')
doc.save()

I create a new record for CFT and CFI

cft = CFT(data = 'y')
cft.save()

cfi = CFI(data = 1)
cfi.save()

now I add them to the doc manytomany table

doc.add(cft)
doc.add(cfi)

now if I get any of the manytomany fields from doc

x = doc.cf.all()[0]

how can I find out if x is an instance of CFT or CFI ????

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