Hello all. Say I have some models like these:

class Image(models.Model):
    file = models.ImageField(upload_to=get_image_path)

class Line(models.Model):
    image = models.ForeignKey(Image)
    color = models.CharField(max_length=20)
    width = models.IntegerField()

class Point(models.Model):
    line = models.ForeignKey(Line)
    ordering = models.IntegerField()
    x = models.IntegerField()
    y = models.IntegerField()

And I want to load an image and all its lines into the interface, add
and remove lines, and then send it back to the controller.

What's the django-ish way to serialize data like this?

The default serializers doesn't seem to do relationships. I saw
discussion[1] of one that does foreign keys but it seems to be going
to in the opposite direction I want (and it doesn't deserialize yet?).

Stepping back, is this sort of thing that you'd be expected to do with
a custom serializer? Or is it better to just serialize each set of
data separately and save them separately. I started by using
simplejson directly but then was wondering about the built-in
serialization code in Django.

Disclaimer: I'm starting on my first real Django project so I still
have limited knowledge the framework. :)

I'm using 1.0.2.

Thanks!
Jason

[1] 
http://groups.google.com/group/django-users/browse_thread/thread/c930cf920e726bbd/4faa358b8c91365d
--~--~---------~--~----~------------~-------~--~----~
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