Skip to content
John Heasly edited this page Feb 13, 2018 · 13 revisions

(Coming back to this months later, I think this is the quick-and-dirty, first pass listing of steps, so I didn't forget.)

How to update civic_calendar2 with civic_calendar data

  1. loaddata auth.user.json
  2. loaddata entity.json (requires search & replace)
  3. loaddata location.json (requires search & replace)
  4. loaddata munged_schedule_event.json (output of json_transformer.py)
  5. create the necessary slugs (because they don't exist in civic_calendar ... )
  6. After importing Entity fixture import, had to re-create every slug(!), so ... :
from civic_calendar2.models import Entity
from django.utils.text import slugify
for e in Entity.objects.all():
    slug = u'{0}-{1}'.format(e.jurisdiction.id, slugify(e.name))
    e.slug = slug
    e.save()
    print u'{0} saved.'.format(slug)

(And I think this is the more fleshed-out step by step down here ... )

  1. Get your Schedule.Event/Civic_calendar.Meeting house in order by first doing the scripts/json_transformer.py munge dance, as you may have Entity and/or Location data that references uncreated/non-existent Schedule.Event and/or User.
  2. Log in to civic_calendar on live django110 server, use Django utility dumpdata to export full civic_calendar and schedule apps.
$ python manage.py dumpdata schedule --format=json --indent=2 --settings=django_root.settings.production > schedule.json
$ python manage.py dumpdata civic_calendar --format=json --indent=2 --settings=django_root.settings.production > civic_calendar.json
  1. Copy schedule.json and civic_calendar.json to civic_calendar2/scripts directory, cd down to civic_calendar2/scripts and run json_transformer.py
  2. cd up to django_root and use loaddata to import the resulting munged_schedule_event.json file.
  3. Still using civic_calendar on live django110 server, use Django utility dumpdata to export Entity, Location model data. Probably won't need to export Jursidiction (unless there's been a new city/town added).
$ python manage.py dumpdata civic_calendar.entity --format=json --indent=2 --settings=django_root.settings.production > civic_calendar.entity.json
$ python manage.py dumpdata civic_calendar.location --format=json --indent=2 --settings=django_root.settings.production > civic_calendar.location.json
  1. Search and replace civic_calendar.entity with civic_calendar2.entity.
  2. Search and replace civic_calendar.location with civic_calendar2.location.
  3. loaddata into your django111 civic_calendar2 app.
Clone this wiki locally