On Mar 31, 10:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2007-03-31 at 05:27 +0000,RamashishBaranwal wrote:
> > Hi,
>
> > I am trying to export a model's data to XML. To do this I'm using the
> > model class's _meta.fields. However it doesn't list ManyToManyField
> > objects. How can I get those?
>
> > My code looks something like this-
>
> > # returns data of inst in a dict
> > def get_data(inst):
> >   data = {}
> >   for field in inst._meta.fields: # Doesn't get ManyToManyFields :(
> >     data[field.name] = getattr(inst, field.name)
> >   return data
>
> Use inst._meta.many_to_many to get the list of many-to-many fields.
>

Thanks Malcolm, that was what I was looking for.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to