~ubuntuone-hackers/django-south/trunk

« back to all changes in this revision

Viewing changes to south/management/commands/datamigration.py

  • Committer: Ricardo Kirkner
  • Date: 2013-06-10 00:19:31 UTC
  • Revision ID: ricardo.kirkner@canonical.com-20130610001931-azfj57kme0qd4uca
Tags: 0.8
added South-0.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Data migration creation command
3
3
"""
4
4
 
 
5
from __future__ import print_function
 
6
 
5
7
import sys
6
8
import os
7
9
import re
68
70
        
69
71
        # - is a special name which means 'print to stdout'
70
72
        if name == "-":
71
 
            print file_contents
 
73
            print(file_contents)
72
74
        # Write the migration file if the name isn't -
73
75
        else:
74
76
            fp = open(os.path.join(migrations.migrations_dir(), new_filename), "w")
75
77
            fp.write(file_contents)
76
78
            fp.close()
77
 
            print >>sys.stderr, "Created %s." % new_filename
 
79
            print("Created %s." % new_filename, file=sys.stderr)
78
80
    
79
81
    def calc_frozen_apps(self, migrations, freeze_list):
80
82
        """
98
100
        """
99
101
        Prints the error, and exits with the given code.
100
102
        """
101
 
        print >>sys.stderr, message
 
103
        print(message, file=sys.stderr)
102
104
        sys.exit(code)
103
105
 
104
106
 
112
114
 
113
115
    def forwards(self, orm):
114
116
        "Write your forwards methods here."
115
 
        # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
 
117
        # Note: Don't use "from appname.models import ModelName". 
 
118
        # Use orm.ModelName to refer to models in this application,
 
119
        # and orm['appname.ModelName'] for models in other applications.
116
120
 
117
121
    def backwards(self, orm):
118
122
        "Write your backwards methods here."