jsonmigrate.py 768 B

123456789101112131415161718192021222324252627
  1. import json
  2. from django.db import migration
  3. def parseData(key, value, apps, schema_editor, project):
  4. if "City" in key:
  5. project(city = value)
  6. elif "Country" in key:
  7. project(country = value)
  8. elif "title" in key:
  9. project(title = value)
  10. elif "Owner" in key:
  11. project(owner = value)
  12. elif "Year" in key:
  13. project(year = value)
  14. elif "teaser" in key:
  15. project(teaser_txt = value)
  16. elif "heading" in key:
  17. project(header = value)
  18. elif "description" in key:
  19. project(description= value)
  20. elif "cid" in key:
  21. project(class_cid = value)
  22. project(cid = 2)
  23. # need 2 parse to int project(cid =value[1:])
  24. elif "category" in key:
  25. project(category = value)