Closed trey closed 3 years ago
Looks like there's a built-in CSV library in Python!
csv — CSV File Reading and Writing — Python 3.8.2rc2 documentation
via https://studygyaan.com/django/how-to-export-csv-file-with-django
Well, look at this: official documentation!
Outputting CSV with Django | Django documentation | Django
This looks promising too:
python - how to import csv data into django models - Stack Overflow
Dang, here's yet another thing that looks almost too good to be true.
How to Export & Import Data in Django | DPS piepworks/cassettenest#3
Turns out there's lots of good info out there on how to deal with CSVs with Django.
Here's how Collectorz.com Comic Connect does it. This seems really smart. I keep being impressed with how they do things.
Here's a snippet from that backup.xml
file:
<?xml version="1.0" encoding="utf-8" ?>
<collectorz>
<response>
<message>2020-05-09 18:28:06</message>
<iserror>0</iserror>
</response>
<meta>
<action>backup</action>
</meta>
<data>
<comicinfo>
<comiclist>
<comic>
<datasetversion>5</datasetversion>
<hash>bebef97ef604d3d79b6d0c19af51e839</hash>
<bpcomicid>52318</bpcomicid>
<mainsection>
<title>Hunger</title>
<series>
<bpseriesid>4491</bpseriesid>
<displayname>Hellblazer</displayname>
</series>
<pagecount>40</pagecount>
<myrating>10</myrating>
<notes><![CDATA[Sold to Jermaine at Acme Comics on April 17, 2017.]]></notes>
</mainsection>
<issuenr>1</issuenr>
<issueext>A</issueext>
<publisher>
<displayname>DC Comics</displayname>
</publisher>
<coverdate>
<year>
<displayname>1988</displayname>
</year>
<month>01</month>
<date>1988/01</date>
</coverdate>
<releasedate>
<year>
<displayname>1987</displayname>
</year>
<month>09</month>
<day>22</day>
<date>1987/09/22</date>
</releasedate>
<addeddate>
<timestamp>1318048541</timestamp>
</addeddate>
<modifieddate>
<timestamp>1550023567</timestamp>
</modifieddate>
<publicationdate>
<year>
<displayname>1988</displayname>
</year>
<month>01</month>
<date>1988/01</date>
</publicationdate>
<format>
<displayname>Comic</displayname>
</format>
<coverfrontdefault>https://clzcomics.r.sizr.io/core/covers/lg/46/46_52318_0_Hunger.jpg</coverfrontdefault>
<coverfrontfilesizedefault>-1</coverfrontfilesizedefault>
<quantity>0</quantity>
<index>188</index>
<collectionstatus listid='1'>Not In Collection</collectionstatus>
<age>
<displayname>Modern</displayname>
</age>
<currentprice>0</currentprice>
<coverprice>1.25</coverprice>
<purchasedate></purchasedate>
<readit boolvalue='1'>Yes</readit>
<readingdate></readingdate>
<tags></tags>
<loans></loans>
<collection>
<displayname>Sold to Acme Comics (mostly)</displayname>
<sortid>1</sortid>
<hash>d2d6fcd3b3d97784ca6cb9617b126d8c</hash>
</collection>
<iskeycomic boolvalue='0'>No</iskeycomic>
<valueislocked boolvalue='0'>No</valueislocked>
<grade>
<id>0</id>
<rating>0.0</rating>
</grade>
<isslabbed boolvalue='0'>Raw</isslabbed>
<country>
<displayname>USA</displayname>
</country>
<signees></signees>
<genres></genres>
</comic>
This looks interesting: https://github.com/django-import-export/django-import-export
saxix/django-adminactions: collection of useful django actions to use with ModelAdmin or AdminSite.
This has an export CSV action.
Create exports that can be easily imported again.
Make it so you could literally delete your account and recreate it again if you wanted to.
Maybe CSV. Then you could export and just import it into a spreadsheet too.