Re: dump data using json

2009-08-21 Thread Sam Lai

2009/8/22 ashish tiwari :
> hi Friends
>
> i heared about the json format
> django provided utility of dumpdata, loaddata which dumps and loads data in
> json format.
>
> but i dont know,how to use it..
>
> i want to dumpdata...from my app
>
> name of  iFriends
> name of  People
>
> iFriends>People>models.py
>
> class Person.
>

In your project directory,

python manage.py dumpdata People.Person

http://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata

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



Re: dump data using json

2009-08-21 Thread Shawn Milochik


On Aug 21, 2009, at 11:39 AM, ashish tiwari wrote:

> hi Friends
>
> i heared about the json format
> django provided utility of dumpdata, loaddata which dumps and loads  
> data in json format.
>
> but i dont know,how to use it..
>
> i want to dumpdata...from my app
>
> name of  iFriends
> name of  People
>
> iFriends>People>models.py
>
> class Person.
>
> class Item
>
> so i want to dump all data which is present in class "Person"
>  how can i "dumpdata"  from my app "class Person " in   " .json "
> fromat and  "loaddata"
>
>
> thank you...
>
>
> -
> ashish
>


Please be more clear about what you're trying to do. You can use  
simplejson to convert Python objects, such as lists and dictionaries,  
into JSON, and the reverse as well. However, you can't just dump a  
complex object such as a model to a JSON string. I ask for more  
explanation because you can't dump all data from "a class" anyway --  
you'd have to instantiate the class (pull one record from the  
database) and dump data from it.

Shawn

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



dump data using json

2009-08-21 Thread ashish tiwari
hi Friends

i heared about the json format
django provided utility of dumpdata, loaddata which dumps and loads data in
json format.

but i dont know,how to use it..

i want to dumpdata...from my app

name of  iFriends
name of  People

iFriends>People>models.py

class Person.

class Item

so i want to dump all data which is present in class "Person"
 how can i "dumpdata"  from my app "class Person " in   " .json "   fromat
and  "loaddata"


thank you...


-
ashish

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