Revision c11dc0ce

/dev/null
1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

  
7
class Migration(SchemaMigration):
8

  
9
    def forwards(self, orm):
10
        
11
        # Deleting model 'MemberLeavePolicy'
12
        db.delete_table('im_memberleavepolicy')
13

  
14
        # Deleting model 'MemberJoinPolicy'
15
        db.delete_table('im_memberjoinpolicy')
16

  
17
        # Renaming column for 'ProjectApplication.member_join_policy' to match new field type.
18
        db.rename_column('im_projectapplication', 'member_join_policy_id', 'member_join_policy')
19
        # Changing field 'ProjectApplication.member_join_policy'
20
        db.alter_column('im_projectapplication', 'member_join_policy', self.gf('django.db.models.fields.IntegerField')())
21

  
22
        # Removing index on 'ProjectApplication', fields ['member_join_policy']
23
        db.delete_index('im_projectapplication', ['member_join_policy_id'])
24

  
25
        # Renaming column for 'ProjectApplication.member_leave_policy' to match new field type.
26
        db.rename_column('im_projectapplication', 'member_leave_policy_id', 'member_leave_policy')
27
        # Changing field 'ProjectApplication.member_leave_policy'
28
        db.alter_column('im_projectapplication', 'member_leave_policy', self.gf('django.db.models.fields.IntegerField')())
29

  
30
        # Removing index on 'ProjectApplication', fields ['member_leave_policy']
31
        db.delete_index('im_projectapplication', ['member_leave_policy_id'])
32

  
33

  
34
    def backwards(self, orm):
35
        
36
        # Adding index on 'ProjectApplication', fields ['member_leave_policy']
37
        db.create_index('im_projectapplication', ['member_leave_policy_id'])
38

  
39
        # Adding index on 'ProjectApplication', fields ['member_join_policy']
40
        db.create_index('im_projectapplication', ['member_join_policy_id'])
41

  
42
        # Adding model 'MemberLeavePolicy'
43
        db.create_table('im_memberleavepolicy', (
44
            ('policy', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, db_index=True)),
45
            ('description', self.gf('django.db.models.fields.CharField')(max_length=80)),
46
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
47
        ))
48
        db.send_create_signal('im', ['MemberLeavePolicy'])
49

  
50
        # Adding model 'MemberJoinPolicy'
51
        db.create_table('im_memberjoinpolicy', (
52
            ('policy', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, db_index=True)),
53
            ('description', self.gf('django.db.models.fields.CharField')(max_length=80)),
54
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
55
        ))
56
        db.send_create_signal('im', ['MemberJoinPolicy'])
57

  
58
        # Renaming column for 'ProjectApplication.member_join_policy' to match new field type.
59
        db.rename_column('im_projectapplication', 'member_join_policy', 'member_join_policy_id')
60
        # Changing field 'ProjectApplication.member_join_policy'
61
        db.alter_column('im_projectapplication', 'member_join_policy_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.MemberJoinPolicy']))
62

  
63
        # Renaming column for 'ProjectApplication.member_leave_policy' to match new field type.
64
        db.rename_column('im_projectapplication', 'member_leave_policy', 'member_leave_policy_id')
65
        # Changing field 'ProjectApplication.member_leave_policy'
66
        db.alter_column('im_projectapplication', 'member_leave_policy_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.MemberLeavePolicy']))
67

  
68

  
69
    models = {
70
        'auth.group': {
71
            'Meta': {'object_name': 'Group'},
72
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
73
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
74
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
75
        },
76
        'auth.permission': {
77
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
78
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
79
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
80
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
81
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
82
        },
83
        'auth.user': {
84
            'Meta': {'object_name': 'User'},
85
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
86
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
87
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
88
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
89
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
90
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
91
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
92
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
93
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
94
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
95
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
96
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
97
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
98
        },
99
        'contenttypes.contenttype': {
100
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
101
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
102
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
103
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
104
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
105
        },
106
        'im.additionalmail': {
107
            'Meta': {'object_name': 'AdditionalMail'},
108
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
109
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
110
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
111
        },
112
        'im.approvalterms': {
113
            'Meta': {'object_name': 'ApprovalTerms'},
114
            'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 1, 4, 18, 59, 31, 212689)', 'db_index': 'True'}),
115
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116
            'location': ('django.db.models.fields.CharField', [], {'max_length': '255'})
117
        },
118
        'im.astakosuser': {
119
            'Meta': {'object_name': 'AstakosUser', '_ormbases': ['auth.User']},
120
            'activation_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
121
            'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
122
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
123
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
124
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
125
            'date_signed_terms': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
126
            'disturbed_quota': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
127
            'email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
128
            'has_credits': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
129
            'has_signed_terms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
130
            'invitations': ('django.db.models.fields.IntegerField', [], {'default': '100'}),
131
            'is_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
132
            'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
133
            'policy': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.AstakosUserQuota']", 'symmetrical': 'False'}),
134
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
135
            'third_party_identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
136
            'updated': ('django.db.models.fields.DateTimeField', [], {}),
137
            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
138
            'uuid': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True'})
139
        },
140
        'im.astakosuserauthprovider': {
141
            'Meta': {'ordering': "('module', 'created')", 'unique_together': "(('identifier', 'module', 'user'),)", 'object_name': 'AstakosUserAuthProvider'},
142
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
143
            'affiliation': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
144
            'auth_backend': ('django.db.models.fields.CharField', [], {'default': "'astakos'", 'max_length': '255'}),
145
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
146
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
147
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
148
            'info_data': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
149
            'module': ('django.db.models.fields.CharField', [], {'default': "'local'", 'max_length': '255'}),
150
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_providers'", 'to': "orm['im.AstakosUser']"})
151
        },
152
        'im.astakosuserquota': {
153
            'Meta': {'unique_together': "(('resource', 'user'),)", 'object_name': 'AstakosUserQuota'},
154
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
155
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
156
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"}),
157
            'uplimit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
158
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
159
        },
160
        'im.emailchange': {
161
            'Meta': {'object_name': 'EmailChange'},
162
            'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'db_index': 'True'}),
163
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
164
            'new_email_address': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
165
            'requested_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 1, 4, 18, 59, 31, 214577)'}),
166
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'emailchanges'", 'unique': 'True', 'to': "orm['im.AstakosUser']"})
167
        },
168
        'im.invitation': {
169
            'Meta': {'object_name': 'Invitation'},
170
            'code': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
171
            'consumed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
172
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
173
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
174
            'inviter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'invitations_sent'", 'null': 'True', 'to': "orm['im.AstakosUser']"}),
175
            'is_consumed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
176
            'realname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
177
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
178
        },
179
        'im.pendingthirdpartyuser': {
180
            'Meta': {'unique_together': "(('provider', 'third_party_identifier'),)", 'object_name': 'PendingThirdPartyUser'},
181
            'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
182
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
183
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
184
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
185
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
186
            'info': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
187
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
188
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
189
            'third_party_identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
190
            'token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
191
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
192
        },
193
        'im.project': {
194
            'Meta': {'object_name': 'Project'},
195
            'application': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'project'", 'unique': 'True', 'to': "orm['im.ProjectApplication']"}),
196
            'creation_date': ('django.db.models.fields.DateTimeField', [], {}),
197
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
198
            'last_approval_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
199
            'members': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.AstakosUser']", 'through': "orm['im.ProjectMembership']", 'symmetrical': 'False'}),
200
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80', 'db_index': 'True'}),
201
            'termination_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
202
            'termination_start_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
203
        },
204
        'im.projectapplication': {
205
            'Meta': {'object_name': 'ProjectApplication'},
206
            'applicant': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects_applied'", 'to': "orm['im.AstakosUser']"}),
207
            'comments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
208
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
209
            'end_date': ('django.db.models.fields.DateTimeField', [], {}),
210
            'homepage': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
211
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
212
            'issue_date': ('django.db.models.fields.DateTimeField', [], {}),
213
            'limit_on_members_number': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
214
            'member_join_policy': ('django.db.models.fields.IntegerField', [], {}),
215
            'member_leave_policy': ('django.db.models.fields.IntegerField', [], {}),
216
            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
217
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects_owned'", 'to': "orm['im.AstakosUser']"}),
218
            'precursor_application': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['im.ProjectApplication']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
219
            'resource_grants': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.ProjectResourceGrant']", 'blank': 'True'}),
220
            'start_date': ('django.db.models.fields.DateTimeField', [], {}),
221
            'state': ('django.db.models.fields.CharField', [], {'default': "'Unknown'", 'max_length': '80'})
222
        },
223
        'im.projectmembership': {
224
            'Meta': {'unique_together': "(('person', 'project'),)", 'object_name': 'ProjectMembership'},
225
            'acceptance_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'db_index': 'True'}),
226
            'application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'memberships'", 'null': 'True', 'to': "orm['im.ProjectApplication']"}),
227
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
228
            'leave_request_date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
229
            'pending_application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pending_memebrships'", 'null': 'True', 'to': "orm['im.ProjectApplication']"}),
230
            'pending_serial': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'db_index': 'True'}),
231
            'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"}),
232
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Project']"}),
233
            'request_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 1, 4, 18, 59, 31, 222965)'}),
234
            'state': ('django.db.models.fields.IntegerField', [], {'default': '0'})
235
        },
236
        'im.projectmembershiphistory': {
237
            'Meta': {'object_name': 'ProjectMembershipHistory'},
238
            'date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime.now'}),
239
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
240
            'person': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
241
            'project': ('django.db.models.fields.BigIntegerField', [], {}),
242
            'reason': ('django.db.models.fields.IntegerField', [], {}),
243
            'serial': ('django.db.models.fields.BigIntegerField', [], {})
244
        },
245
        'im.projectresourcegrant': {
246
            'Meta': {'unique_together': "(('resource', 'project_application'),)", 'object_name': 'ProjectResourceGrant'},
247
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
248
            'member_capacity': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
249
            'member_export_limit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
250
            'member_import_limit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
251
            'project_application': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.ProjectApplication']", 'null': 'True'}),
252
            'project_capacity': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
253
            'project_export_limit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
254
            'project_import_limit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
255
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"})
256
        },
257
        'im.resource': {
258
            'Meta': {'unique_together': "(('name', 'service'),)", 'object_name': 'Resource'},
259
            'desc': ('django.db.models.fields.TextField', [], {'null': 'True'}),
260
            'group': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
261
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
262
            'meta': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.ResourceMetadata']", 'symmetrical': 'False'}),
263
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
264
            'service': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Service']"}),
265
            'unit': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'})
266
        },
267
        'im.resourcemetadata': {
268
            'Meta': {'object_name': 'ResourceMetadata'},
269
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
270
            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
271
            'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
272
        },
273
        'im.serial': {
274
            'Meta': {'object_name': 'Serial'},
275
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
276
        },
277
        'im.service': {
278
            'Meta': {'object_name': 'Service'},
279
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
280
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
281
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
282
            'icon': ('django.db.models.fields.FilePathField', [], {'max_length': '100', 'blank': 'True'}),
283
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
284
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
285
            'url': ('django.db.models.fields.FilePathField', [], {'max_length': '100'})
286
        },
287
        'im.sessioncatalog': {
288
            'Meta': {'object_name': 'SessionCatalog'},
289
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
290
            'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
291
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sessions'", 'null': 'True', 'to': "orm['im.AstakosUser']"})
292
        }
293
    }
294

  
295
    complete_apps = ['im']
b/snf-astakos-app/astakos/im/migrations/0049_auto__del_memberleavepolicy__del_memberjoinpolicy__chg_field_projectre.py
1
# encoding: utf-8
2
import datetime
3
from south.db import db
4
from south.v2 import SchemaMigration
5
from django.db import models
6

  
7
class Migration(SchemaMigration):
8

  
9
    def forwards(self, orm):
10
        
11
        # Deleting model 'MemberLeavePolicy'
12
        db.delete_table('im_memberleavepolicy')
13

  
14
        # Deleting model 'MemberJoinPolicy'
15
        db.delete_table('im_memberjoinpolicy')
16

  
17
        # Changing field 'ProjectResourceGrant.project_export_limit'
18
        db.alter_column('im_projectresourcegrant', 'project_export_limit', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
19

  
20
        # Changing field 'ProjectResourceGrant.project_import_limit'
21
        db.alter_column('im_projectresourcegrant', 'project_import_limit', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
22

  
23
        # Changing field 'ProjectResourceGrant.member_export_limit'
24
        db.alter_column('im_projectresourcegrant', 'member_export_limit', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
25

  
26
        # Changing field 'ProjectResourceGrant.member_capacity'
27
        db.alter_column('im_projectresourcegrant', 'member_capacity', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
28

  
29
        # Changing field 'ProjectResourceGrant.member_import_limit'
30
        db.alter_column('im_projectresourcegrant', 'member_import_limit', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
31

  
32
        # Changing field 'ProjectResourceGrant.project_capacity'
33
        db.alter_column('im_projectresourcegrant', 'project_capacity', self.gf('synnefo.lib.db.intdecimalfield.IntDecimalField')(max_digits=38, decimal_places=0))
34

  
35
        # Renaming column for 'ProjectApplication.member_join_policy' to match new field type.
36
        db.rename_column('im_projectapplication', 'member_join_policy_id', 'member_join_policy')
37
        # Changing field 'ProjectApplication.member_join_policy'
38
        db.alter_column('im_projectapplication', 'member_join_policy', self.gf('django.db.models.fields.IntegerField')())
39

  
40
        # Removing index on 'ProjectApplication', fields ['member_join_policy']
41
        db.delete_index('im_projectapplication', ['member_join_policy_id'])
42

  
43
        # Renaming column for 'ProjectApplication.member_leave_policy' to match new field type.
44
        db.rename_column('im_projectapplication', 'member_leave_policy_id', 'member_leave_policy')
45
        # Changing field 'ProjectApplication.member_leave_policy'
46
        db.alter_column('im_projectapplication', 'member_leave_policy', self.gf('django.db.models.fields.IntegerField')())
47

  
48
        # Removing index on 'ProjectApplication', fields ['member_leave_policy']
49
        db.delete_index('im_projectapplication', ['member_leave_policy_id'])
50

  
51

  
52
    def backwards(self, orm):
53
        
54
        # Adding model 'MemberLeavePolicy'
55
        db.create_table('im_memberleavepolicy', (
56
            ('policy', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, db_index=True)),
57
            ('description', self.gf('django.db.models.fields.CharField')(max_length=80)),
58
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
59
        ))
60
        db.send_create_signal('im', ['MemberLeavePolicy'])
61

  
62
        # Adding model 'MemberJoinPolicy'
63
        db.create_table('im_memberjoinpolicy', (
64
            ('policy', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, db_index=True)),
65
            ('description', self.gf('django.db.models.fields.CharField')(max_length=80)),
66
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
67
        ))
68
        db.send_create_signal('im', ['MemberJoinPolicy'])
69

  
70
        # Changing field 'ProjectResourceGrant.project_export_limit'
71
        db.alter_column('im_projectresourcegrant', 'project_export_limit', self.gf('django.db.models.fields.BigIntegerField')(null=True))
72

  
73
        # Changing field 'ProjectResourceGrant.project_import_limit'
74
        db.alter_column('im_projectresourcegrant', 'project_import_limit', self.gf('django.db.models.fields.BigIntegerField')(null=True))
75

  
76
        # Changing field 'ProjectResourceGrant.member_export_limit'
77
        db.alter_column('im_projectresourcegrant', 'member_export_limit', self.gf('django.db.models.fields.BigIntegerField')(null=True))
78

  
79
        # Changing field 'ProjectResourceGrant.member_capacity'
80
        db.alter_column('im_projectresourcegrant', 'member_capacity', self.gf('django.db.models.fields.BigIntegerField')(null=True))
81

  
82
        # Changing field 'ProjectResourceGrant.member_import_limit'
83
        db.alter_column('im_projectresourcegrant', 'member_import_limit', self.gf('django.db.models.fields.BigIntegerField')(null=True))
84

  
85
        # Changing field 'ProjectResourceGrant.project_capacity'
86
        db.alter_column('im_projectresourcegrant', 'project_capacity', self.gf('django.db.models.fields.BigIntegerField')(null=True))
87

  
88
        # Renaming column for 'ProjectApplication.member_join_policy' to match new field type.
89
        db.rename_column('im_projectapplication', 'member_join_policy', 'member_join_policy_id')
90
        # Changing field 'ProjectApplication.member_join_policy'
91
        db.alter_column('im_projectapplication', 'member_join_policy_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.MemberJoinPolicy']))
92

  
93
        # Renaming column for 'ProjectApplication.member_leave_policy' to match new field type.
94
        db.rename_column('im_projectapplication', 'member_leave_policy', 'member_leave_policy_id')
95
        # Changing field 'ProjectApplication.member_leave_policy'
96
        db.alter_column('im_projectapplication', 'member_leave_policy_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['im.MemberLeavePolicy']))
97

  
98
        # Adding index on 'ProjectApplication', fields ['member_leave_policy']
99
        db.create_index('im_projectapplication', ['member_leave_policy_id'])
100

  
101
        # Adding index on 'ProjectApplication', fields ['member_join_policy']
102
        db.create_index('im_projectapplication', ['member_join_policy_id'])
103

  
104

  
105
    models = {
106
        'auth.group': {
107
            'Meta': {'object_name': 'Group'},
108
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
109
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
110
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
111
        },
112
        'auth.permission': {
113
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
114
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
115
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
116
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
117
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
118
        },
119
        'auth.user': {
120
            'Meta': {'object_name': 'User'},
121
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
122
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
123
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
124
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
125
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
126
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
127
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
128
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
129
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
130
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
131
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
132
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
133
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
134
        },
135
        'contenttypes.contenttype': {
136
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
137
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
138
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
139
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
140
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
141
        },
142
        'im.additionalmail': {
143
            'Meta': {'object_name': 'AdditionalMail'},
144
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
145
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
146
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
147
        },
148
        'im.approvalterms': {
149
            'Meta': {'object_name': 'ApprovalTerms'},
150
            'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 1, 7, 15, 0, 24, 50514)', 'db_index': 'True'}),
151
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
152
            'location': ('django.db.models.fields.CharField', [], {'max_length': '255'})
153
        },
154
        'im.astakosuser': {
155
            'Meta': {'object_name': 'AstakosUser', '_ormbases': ['auth.User']},
156
            'activation_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
157
            'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
158
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
159
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
160
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
161
            'date_signed_terms': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
162
            'disturbed_quota': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
163
            'email_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
164
            'has_credits': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
165
            'has_signed_terms': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
166
            'invitations': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
167
            'is_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
168
            'level': ('django.db.models.fields.IntegerField', [], {'default': '4'}),
169
            'policy': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.AstakosUserQuota']", 'symmetrical': 'False'}),
170
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
171
            'third_party_identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
172
            'updated': ('django.db.models.fields.DateTimeField', [], {}),
173
            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
174
            'uuid': ('django.db.models.fields.CharField', [], {'max_length': '255', 'unique': 'True', 'null': 'True'})
175
        },
176
        'im.astakosuserauthprovider': {
177
            'Meta': {'ordering': "('module', 'created')", 'unique_together': "(('identifier', 'module', 'user'),)", 'object_name': 'AstakosUserAuthProvider'},
178
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
179
            'affiliation': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True', 'blank': 'True'}),
180
            'auth_backend': ('django.db.models.fields.CharField', [], {'default': "'astakos'", 'max_length': '255'}),
181
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
182
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
183
            'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
184
            'info_data': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
185
            'module': ('django.db.models.fields.CharField', [], {'default': "'local'", 'max_length': '255'}),
186
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'auth_providers'", 'to': "orm['im.AstakosUser']"})
187
        },
188
        'im.astakosuserquota': {
189
            'Meta': {'unique_together': "(('resource', 'user'),)", 'object_name': 'AstakosUserQuota'},
190
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
191
            'limit': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
192
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"}),
193
            'uplimit': ('django.db.models.fields.BigIntegerField', [], {'null': 'True'}),
194
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"})
195
        },
196
        'im.emailchange': {
197
            'Meta': {'object_name': 'EmailChange'},
198
            'activation_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40', 'db_index': 'True'}),
199
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
200
            'new_email_address': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
201
            'requested_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 1, 7, 15, 0, 24, 51288)'}),
202
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'emailchanges'", 'unique': 'True', 'to': "orm['im.AstakosUser']"})
203
        },
204
        'im.invitation': {
205
            'Meta': {'object_name': 'Invitation'},
206
            'code': ('django.db.models.fields.BigIntegerField', [], {'db_index': 'True'}),
207
            'consumed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
208
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
209
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
210
            'inviter': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'invitations_sent'", 'null': 'True', 'to': "orm['im.AstakosUser']"}),
211
            'is_consumed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
212
            'realname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
213
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'})
214
        },
215
        'im.pendingthirdpartyuser': {
216
            'Meta': {'unique_together': "(('provider', 'third_party_identifier'),)", 'object_name': 'PendingThirdPartyUser'},
217
            'affiliation': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
218
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
219
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
220
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
221
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
222
            'info': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
223
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
224
            'provider': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
225
            'third_party_identifier': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
226
            'token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
227
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
228
        },
229
        'im.project': {
230
            'Meta': {'object_name': 'Project'},
231
            'application': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'project'", 'unique': 'True', 'to': "orm['im.ProjectApplication']"}),
232
            'creation_date': ('django.db.models.fields.DateTimeField', [], {}),
233
            'deactivation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
234
            'deactivation_reason': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
235
            'deactivation_start_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
236
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
237
            'last_approval_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
238
            'members': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.AstakosUser']", 'through': "orm['im.ProjectMembership']", 'symmetrical': 'False'}),
239
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80', 'db_index': 'True'})
240
        },
241
        'im.projectapplication': {
242
            'Meta': {'object_name': 'ProjectApplication'},
243
            'applicant': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects_applied'", 'to': "orm['im.AstakosUser']"}),
244
            'comments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
245
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
246
            'end_date': ('django.db.models.fields.DateTimeField', [], {}),
247
            'homepage': ('django.db.models.fields.URLField', [], {'max_length': '255', 'null': 'True'}),
248
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
249
            'issue_date': ('django.db.models.fields.DateTimeField', [], {}),
250
            'limit_on_members_number': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
251
            'member_join_policy': ('django.db.models.fields.IntegerField', [], {}),
252
            'member_leave_policy': ('django.db.models.fields.IntegerField', [], {}),
253
            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
254
            'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'projects_owned'", 'to': "orm['im.AstakosUser']"}),
255
            'precursor_application': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['im.ProjectApplication']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
256
            'resource_grants': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['im.Resource']", 'null': 'True', 'through': "orm['im.ProjectResourceGrant']", 'blank': 'True'}),
257
            'start_date': ('django.db.models.fields.DateTimeField', [], {}),
258
            'state': ('django.db.models.fields.CharField', [], {'default': "'Unknown'", 'max_length': '80'})
259
        },
260
        'im.projectmembership': {
261
            'Meta': {'unique_together': "(('person', 'project'),)", 'object_name': 'ProjectMembership'},
262
            'acceptance_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'db_index': 'True'}),
263
            'application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'memberships'", 'null': 'True', 'to': "orm['im.ProjectApplication']"}),
264
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
265
            'leave_request_date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
266
            'pending_application': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'pending_memebrships'", 'null': 'True', 'to': "orm['im.ProjectApplication']"}),
267
            'pending_serial': ('django.db.models.fields.BigIntegerField', [], {'null': 'True', 'db_index': 'True'}),
268
            'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.AstakosUser']"}),
269
            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Project']"}),
270
            'request_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 1, 7, 15, 0, 24, 54113)'}),
271
            'state': ('django.db.models.fields.IntegerField', [], {'default': '0'})
272
        },
273
        'im.projectmembershiphistory': {
274
            'Meta': {'object_name': 'ProjectMembershipHistory'},
275
            'date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime.now'}),
276
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
277
            'person': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
278
            'project': ('django.db.models.fields.BigIntegerField', [], {}),
279
            'reason': ('django.db.models.fields.IntegerField', [], {}),
280
            'serial': ('django.db.models.fields.BigIntegerField', [], {})
281
        },
282
        'im.projectresourcegrant': {
283
            'Meta': {'unique_together': "(('resource', 'project_application'),)", 'object_name': 'ProjectResourceGrant'},
284
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
285
            'member_capacity': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
286
            'member_export_limit': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
287
            'member_import_limit': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
288
            'project_application': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.ProjectApplication']", 'null': 'True'}),
289
            'project_capacity': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
290
            'project_export_limit': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
291
            'project_import_limit': ('synnefo.lib.db.intdecimalfield.IntDecimalField', [], {'default': '100000000000000000000000000000000L', 'max_digits': '38', 'decimal_places': '0'}),
292
            'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Resource']"})
293
        },
294
        'im.resource': {
295
            'Meta': {'unique_together': "(('name', 'service'),)", 'object_name': 'Resource'},
296
            'desc': ('django.db.models.fields.TextField', [], {'null': 'True'}),
297
            'group': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}),
298
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
299
            'meta': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['im.ResourceMetadata']", 'symmetrical': 'False'}),
300
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
301
            'service': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['im.Service']"}),
302
            'unit': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'})
303
        },
304
        'im.resourcemetadata': {
305
            'Meta': {'object_name': 'ResourceMetadata'},
306
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
307
            'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
308
            'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
309
        },
310
        'im.serial': {
311
            'Meta': {'object_name': 'Serial'},
312
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
313
        },
314
        'im.service': {
315
            'Meta': {'object_name': 'Service'},
316
            'auth_token': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
317
            'auth_token_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
318
            'auth_token_expires': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
319
            'icon': ('django.db.models.fields.FilePathField', [], {'max_length': '100', 'blank': 'True'}),
320
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
321
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255', 'db_index': 'True'}),
322
            'url': ('django.db.models.fields.FilePathField', [], {'max_length': '100'})
323
        },
324
        'im.sessioncatalog': {
325
            'Meta': {'object_name': 'SessionCatalog'},
326
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
327
            'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
328
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'sessions'", 'null': 'True', 'to': "orm['im.AstakosUser']"})
329
        }
330
    }
331

  
332
    complete_apps = ['im']
b/snf-astakos-app/astakos/im/models.py
77 77
import astakos.im.messages as astakos_messages
78 78
from .managers import ForUpdateManager
79 79

  
80
from synnefo.lib.quotaholder.api import QH_PRACTICALLY_INFINITE
81
from synnefo.lib.db.intdecimalfield import intDecimalField
82

  
80 83
logger = logging.getLogger(__name__)
81 84

  
82 85
DEFAULT_CONTENT_TYPE = None
......
1325 1328
    resource                =   models.ForeignKey(Resource)
1326 1329
    project_application     =   models.ForeignKey(ProjectApplication,
1327 1330
                                                  null=True)
1328
    project_capacity        =   models.BigIntegerField(null=True)
1329
    project_import_limit    =   models.BigIntegerField(null=True)
1330
    project_export_limit    =   models.BigIntegerField(null=True)
1331
    member_capacity         =   models.BigIntegerField(null=True)
1332
    member_import_limit     =   models.BigIntegerField(null=True)
1333
    member_export_limit     =   models.BigIntegerField(null=True)
1331
    project_capacity        =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1332
    project_import_limit    =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1333
    project_export_limit    =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1334
    member_capacity         =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1335
    member_import_limit     =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1336
    member_export_limit     =   intDecimalField(default=QH_PRACTICALLY_INFINITE)
1334 1337

  
1335 1338
    objects = ExtendedManager()
1336 1339

  
b/snf-common/synnefo/lib/db/intdecimalfield.py
1
from django.core import exceptions
2
from django.db.models import DecimalField, SubfieldBase
3
from django.utils.translation import ugettext_lazy as _
4
import decimal
5

  
6
class IntDecimalField(DecimalField):
7

  
8
    __metaclass__ = SubfieldBase
9

  
10
    description = _("Integer number as decimal")
11

  
12
    def to_python(self, value):
13
        if value is None:
14
            return value
15
        try:
16
            return long(value)
17
        except (ValueError, TypeError):
18
            raise exceptions.ValidationError(self.error_messages['invalid'])
19

  
20
    def _to_decimal(self, value):
21
        if value is None:
22
            return value
23
        try:
24
            return decimal.Decimal(value)
25
        except decimal.InvalidOperation:
26
            raise exceptions.ValidationError(self.error_messages['invalid'])
27

  
28
    def get_db_prep_save(self, value, connection):
29
        return connection.ops.value_to_db_decimal(self._to_decimal(value),
30
                self.max_digits, self.decimal_places)
31

  
32
    def get_prep_value(self, value):
33
        return self._to_decimal(value)
34

  
35
    def formfield(self, **kwargs):
36
        defaults = {'form_class': forms.IntegerField}
37
        defaults.update(kwargs)
38
        return super(IntegerField, self).formfield(**defaults)
39

  
40
from south.modelsinspector import add_introspection_rules
41
add_introspection_rules([], ["^synnefo\.lib\.db\.intdecimalfield\.IntDecimalField"])
42

  
43
DECIMAL_DIGITS  =   38
44

  
45
def intDecimalField(**kwargs):
46
    # decimal_places is set here instead of the object constructor
47
    # in order to convince south
48
    return IntDecimalField(max_digits=DECIMAL_DIGITS, decimal_places=0, **kwargs)
b/snf-quotaholder-app/quotaholder_django/quotaholder_app/models.py
33 33

  
34 34

  
35 35
from synnefo.lib.commissioning import CorruptedError
36
from synnefo.lib.db.intdecimalfield import intDecimalField
36 37

  
37
from django.core import exceptions
38 38
from django.db.models import (Model, BigIntegerField, CharField,
39
                              IntegerField, SubfieldBase,
40
                              ForeignKey, AutoField, DecimalField)
39
                              ForeignKey, AutoField)
41 40
from django.db import transaction
42 41
from .managers import ForUpdateManager
43 42

  
44
class IntDecimalField(IntegerField):
45

  
46
    __metaclass__ = SubfieldBase
47

  
48
    def __init__(self, max_digits=None, **kwargs):
49
        self.max_digits, self.decimal_places = max_digits, 0
50
        IntegerField.__init__(self, **kwargs)
51

  
52
    def get_internal_type(self):
53
        return "DecimalField"
54

  
55
    def to_python(self, value):
56
        if value is None:
57
            return value
58
        try:
59
            return long(value)
60
        except (ValueError, TypeError):
61
            raise exceptions.ValidationError(self.error_messages['invalid'])
62

  
63
DECIMAL_DIGITS  =   38
64

  
65
def intDecimalField(**kwargs):
66
    return IntDecimalField(max_digits=DECIMAL_DIGITS, **kwargs)
67

  
68 43
class Holder(Model):
69 44

  
70 45
    attribute   =   CharField(max_length=4096, primary_key=True)

Also available in: Unified diff