Ignore:
Timestamp:
Dec 28, 2011, 7:13:04 AM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
aaaa0ae
Parents:
d6e6622
git-author:
Alex Dehnert <adehnert@…> (12/28/11 07:13:04)
git-committer:
Alex Dehnert <adehnert@…> (12/28/11 07:13:04)
Message:

Populate version history better (Trac: #49)

  • Data migration (0019_initial_revs) to run the createinitialrevisions management command, which revisions with the initial data of all the versioned models
  • Use reversion when importing new data in util/import_db.py
  • Data migration (0019_initial_revs) to create the user import_db.py claims created its revisions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/util/import_db.py

    rd6e6622 ra1ff79a  
    1010    sys.path.append(django_dir)
    1111    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
     12
     13import django.contrib.auth.models
     14import reversion
    1215
    1316import groups.models
     
    9194    reader = csv.reader(indb)
    9295    header = reader.next()
    93     for line in reader:
    94         d = dictize_line(header, line)
    95         print d
    96         import_group(d)
     96    with reversion.create_revision():
     97        for line in reader:
     98            d = dictize_line(header, line)
     99            print d
     100            import_group(d)
     101        importer = django.contrib.auth.models.User.objects.get(username='importer@SYSTEM', )
     102        reversion.set_user(importer)
     103        reversion.set_comment("Groups importer")
Note: See TracChangeset for help on using the changeset viewer.