I have read the docs at:

http://docs.djangoproject.com/en/dev/topics/serialization/#inherited-models

That offer the following example for inherited serialization:

class Place(models.Model):
    name = models.CharField(max_length=50)

class Restaurant(Place):
    serves_hot_dogs = models.BooleanField()

all_objects = list(Restaurant.objects.all()) + list(Place.objects.all
())
data = serializers.serialize('xml', all_objects)

This works properly if I only have one class (Restaurant) inheriting
from my base model of Place.  However, if I have a second class, say:

class BurgerStand(Place):
     patty_size = models.FloatField()

Then if I try:
all_objects = list(BurgerStand.objects.all()) + list(Place.objects.all
())
data = serializers.serialize('xml', all_objects)

I get all Place objects - even the ones that are not related in any
way to BurgerStand.  Of course I also no longer get the correct
results for my Restaurant query either.  Is there a way to have the
serializer properly traverse the inherited relationship in a way that
I only get the appropriate results in my serialized result?

Thanks.



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