1

Im using a puython script to dumpdata to a json file, and then from there convert it to csv.

call_command('dumpdata','document_manager.%s' % model_name,format='json',indent=2,stdout=output)

This is the date and time from the generated JSON file:

 "timestamp": "2014-01-07T08:29:16.857Z", 
 "date": "2014-01-07T08:29:13Z", 

Is it possible to output it in this formatting rather?

2014-01-07 08:29:16.000857
Harry
  • 13,091
  • 29
  • 107
  • 167

1 Answers1

1

No, it is not possible with the dumpdata command. You would need to post process your json file with e.g. sed, awk or even a little python script.

But if you just need to output your table as CSV, have a look at https://djangosnippets.org/snippets/2240/

mawimawi
  • 4,222
  • 3
  • 33
  • 52