Nobody has a quick answer ?

On Dec 20, 4:11 pm, gregory semah <gregory.se...@gmail.com> wrote:
> Hi all,
>
> I'm searching a simple way to generate xml from my models, and a
> simple use of serializers can do this for me.
> But my models are defined with ForeignKey and ManyToManyField...
> The xml generated shows me only key values of these field.
>
> Is there a simple way to catch any other field value than "id",
> related to ForeignKey or ManyToManyField?
> I mean with this example:
>
> class Shirt(models.Model):
>        color = ManyToManyField(Color)
>        name = models.CharField(max_length=255)
>
> class Color(models.Model):
>        value = models.CharField(max_length=6)
>        ....
>
> to generate this kind of xml (not really this one but the same tree
> structure)
>
> <shirt name="fdkfjb">
>      <color>000000</color>
>      <color>00EE00</color>
>      <color>0000FF</color>
> </shirt>
>
> and NOT (as i try to explain):
>
> <shirt name="fdkfjb">
>      <color>1</color>
>      <color>2</color>
>      <color>3</color>
> </shirt>
>
> Thanks for your answer
>
> Greg

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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