Fix error when sorting Job list by object.
[ganeti_webmgr.git] / ganeti_web / migrations / 0018_null_to_blank_VirtualMachineTemplate.py
blobce6bbf2b96583d8ee3ab792ae27fe01c670fbba2
1 # -*- coding: utf-8 -*-
2 import datetime
3 from south.db import db
4 from south.v2 import DataMigration
5 from django.db import models
8 class Migration(DataMigration):
10 def forwards(self, orm):
11 # nic_type, root_path, template_name, cdrom2_image_path,
12 # cdrom_image_path, kernel_path, description,
13 # boot_order, pnode, snode, disk_type, iallocator_hostname
14 vmts = orm['ganeti_web.VirtualMachineTemplate'].objects
15 vmts.filter(nic_type__isnull=True).update(nic_type='')
16 vmts.filter(root_path__isnull=True).update(root_path='')
17 vmts.filter(template_name__isnull=True).update(template_name='')
18 vmts.filter(cdrom2_image_path__isnull=True).update(cdrom2_image_path='')
19 vmts.filter(cdrom_image_path__isnull=True).update(cdrom_image_path='')
20 vmts.filter(kernel_path__isnull=True).update(kernel_path='')
21 vmts.filter(description__isnull=True).update(description='')
22 vmts.filter(boot_order__isnull=True).update(boot_order='')
23 vmts.filter(pnode__isnull=True).update(pnode='')
24 vmts.filter(snode__isnull=True).update(snode='')
25 vmts.filter(disk_type__isnull=True).update(disk_type='')
26 vmts.filter(iallocator_hostname__isnull=True).update(iallocator_hostname='')
28 def backwards(self, orm):
29 raise RuntimeError("This migration is not backwards compatible")
31 models = {
32 'auth.group': {
33 'Meta': {'object_name': 'Group'},
34 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
35 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
36 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
38 'auth.permission': {
39 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
40 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
41 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
42 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
43 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
45 'auth.user': {
46 'Meta': {'object_name': 'User'},
47 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
48 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
49 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
50 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
51 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
52 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
53 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
54 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
55 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
56 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
57 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
58 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
59 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
61 'contenttypes.contenttype': {
62 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
63 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
64 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
65 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
66 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
68 'ganeti_web.cluster': {
69 'Meta': {'ordering': "['hostname', 'description']", 'object_name': 'Cluster'},
70 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
71 'description': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
72 'disk': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
73 'hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
74 'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
75 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
76 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
77 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'cluster_last_job'", 'null': 'True', 'to': "orm['ganeti_web.Job']"}),
78 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
79 'password': ('ganeti_web.fields.PatchedEncryptedCharField', [], {'default': "''", 'max_length': '293', 'cipher': "'AES'", 'blank': 'True'}),
80 'port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '5080'}),
81 'ram': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
82 'serialized_info': ('django.db.models.fields.TextField', [], {'default': "''"}),
83 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
84 'username': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
85 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
87 'ganeti_web.cluster_perms': {
88 'Meta': {'object_name': 'Cluster_Perms'},
89 'admin': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
90 'create_vm': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
91 'export': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
92 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Cluster_gperms'", 'null': 'True', 'to': "orm['auth.Group']"}),
93 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
94 'migrate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
95 'obj': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'operms'", 'to': "orm['ganeti_web.Cluster']"}),
96 'replace_disks': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
97 'tags': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
98 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Cluster_uperms'", 'null': 'True', 'to': "orm['auth.User']"})
100 'ganeti_web.clusteruser': {
101 'Meta': {'object_name': 'ClusterUser'},
102 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
103 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
104 'real_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True'})
106 'ganeti_web.ganetierror': {
107 'Meta': {'ordering': "('-timestamp', 'code', 'msg')", 'object_name': 'GanetiError'},
108 'cleared': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
109 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']"}),
110 'code': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
111 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
112 'msg': ('django.db.models.fields.TextField', [], {}),
113 'obj_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
114 'obj_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ganeti_errors'", 'to': "orm['contenttypes.ContentType']"}),
115 'timestamp': ('django.db.models.fields.DateTimeField', [], {})
117 'ganeti_web.job': {
118 'Meta': {'object_name': 'Job'},
119 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
120 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'jobs'", 'to': "orm['ganeti_web.Cluster']"}),
121 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
122 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
123 'finished': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
124 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
125 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
126 'job_id': ('django.db.models.fields.IntegerField', [], {}),
127 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
128 'object_id': ('django.db.models.fields.IntegerField', [], {}),
129 'op': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
130 'serialized_info': ('django.db.models.fields.TextField', [], {'default': "''"}),
131 'status': ('django.db.models.fields.CharField', [], {'max_length': '10'})
133 'ganeti_web.node': {
134 'Meta': {'object_name': 'Node'},
135 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
136 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'nodes'", 'to': "orm['ganeti_web.Cluster']"}),
137 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
138 'cpus': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
139 'disk_free': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
140 'disk_total': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
141 'hostname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
142 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
143 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
144 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Job']", 'null': 'True'}),
145 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
146 'offline': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
147 'ram_free': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
148 'ram_total': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
149 'role': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
150 'serialized_info': ('django.db.models.fields.TextField', [], {'default': "''"})
152 'ganeti_web.organization': {
153 'Meta': {'object_name': 'Organization', '_ormbases': ['ganeti_web.ClusterUser']},
154 'clusteruser_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ganeti_web.ClusterUser']", 'unique': 'True', 'primary_key': 'True'}),
155 'group': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'organization'", 'unique': 'True', 'to': "orm['auth.Group']"})
157 'ganeti_web.profile': {
158 'Meta': {'object_name': 'Profile', '_ormbases': ['ganeti_web.ClusterUser']},
159 'clusteruser_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['ganeti_web.ClusterUser']", 'unique': 'True', 'primary_key': 'True'}),
160 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'})
162 'ganeti_web.quota': {
163 'Meta': {'object_name': 'Quota'},
164 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'quotas'", 'to': "orm['ganeti_web.Cluster']"}),
165 'disk': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),
166 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
167 'ram': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),
168 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'quotas'", 'to': "orm['ganeti_web.ClusterUser']"}),
169 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'})
171 'ganeti_web.sshkey': {
172 'Meta': {'object_name': 'SSHKey'},
173 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
174 'key': ('django.db.models.fields.TextField', [], {}),
175 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'ssh_keys'", 'to': "orm['auth.User']"})
177 'ganeti_web.testmodel': {
178 'Meta': {'object_name': 'TestModel'},
179 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
180 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']"}),
181 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
182 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
183 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
184 'serialized_info': ('django.db.models.fields.TextField', [], {'default': "''"}),
186 'ganeti_web.virtualmachine': {
187 'Meta': {'ordering': "['hostname']", 'unique_together': "(('cluster', 'hostname'),)", 'object_name': 'VirtualMachine'},
188 'cached': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
189 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'default': '0', 'related_name': "'virtual_machines'", 'to': "orm['ganeti_web.Cluster']"}),
190 'cluster_hash': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
191 'disk_size': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
192 'hostname': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
193 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
194 'ignore_cache': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
195 'last_job': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Job']", 'null': 'True'}),
196 'minram': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
197 'mtime': ('ganeti_web.fields.PreciseDateTimeField', [], {'null': 'True', 'max_digits': '18', 'decimal_places': '6'}),
198 'operating_system': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
199 'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'virtual_machines'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['ganeti_web.ClusterUser']"}),
200 'pending_delete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
201 'primary_node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'primary_vms'", 'null': 'True', 'to': "orm['ganeti_web.Node']"}),
202 'ram': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
203 'secondary_node': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'secondary_vms'", 'null': 'True', 'to': "orm['ganeti_web.Node']"}),
204 'serialized_info': ('django.db.models.fields.TextField', [], {'default': "''"}),
205 'status': ('django.db.models.fields.CharField', [], {'max_length': '14'}),
206 'template': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'null': 'True', 'to': "orm['ganeti_web.VirtualMachineTemplate']"}),
207 'virtual_cpus': ('django.db.models.fields.IntegerField', [], {'default': '-1'})
209 'ganeti_web.virtualmachine_perms': {
210 'Meta': {'object_name': 'VirtualMachine_Perms'},
211 'admin': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
212 'group': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'VirtualMachine_gperms'", 'null': 'True', 'to': "orm['auth.Group']"}),
213 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
214 'modify': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
215 'obj': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'operms'", 'to': "orm['ganeti_web.VirtualMachine']"}),
216 'power': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
217 'remove': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
218 'tags': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
219 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'VirtualMachine_uperms'", 'null': 'True', 'to': "orm['auth.User']"})
221 'ganeti_web.virtualmachinetemplate': {
222 'Meta': {'unique_together': "(('cluster', 'template_name'),)", 'object_name': 'VirtualMachineTemplate'},
223 'boot_order': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
224 'cdrom2_image_path': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
225 'cdrom_image_path': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
226 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ganeti_web.Cluster']", 'null': 'True'}),
227 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
228 'disk_template': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
229 'disk_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
230 'disks': ('django_fields.fields.PickleField', [], {'null': 'True', 'blank': 'True'}),
231 'iallocator': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
232 'iallocator_hostname': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
233 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
234 'ip_check': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
235 'kernel_path': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
236 'memory': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
237 'minmem': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
238 'name_check': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
239 'nic_type': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
240 'nics': ('django_fields.fields.PickleField', [], {'null': 'True', 'blank': 'True'}),
241 'no_install': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
242 'os': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
243 'pnode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
244 'root_path': ('django.db.models.fields.CharField', [], {'default': "'/'", 'max_length': '255', 'null': 'True', 'blank': 'True'}),
245 'serial_console': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
246 'snode': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
247 'start': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
248 'template_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
249 'temporary': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
250 'vcpus': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
254 complete_apps = ['ganeti_web']
255 symmetrical = True