> That's a good pointer, thanks. However I'm still confused about how I
> can actually dump out the data from my test run? For example, say I
> have a particular test and I want to dump the data at some certain
> point. I can put in pdb.set_trace() in the code to stop at the
> appropriate point, but what do I call from that point to create the
> mydata.json file that then gets loaded with the command
>
> django-admin.py testserver mydata.json
>>> from django.core.serializers import serialize
>>> queryset1 = Model1.objects.filter(...)
>>> queryset2 = Model2.objects.filter(...)
>>> fixture = serialize('json', list(queryset1) + list(queryset2))
>>> f = open('mydate.json', 'w')
>>> f.write(fixture)
>>> f.close()
--
Kirill Spitsin
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment