Revision 34d3883a

b/snf-astakos-app/astakos/im/migrations/0026_auto__del_resourcemetadata__add_unique_resource_name__del_unique_resou.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
        # Removing unique constraint on 'Resource', fields ['name', 'service']
12
        db.delete_unique('im_resource', ['name', 'service_id'])
13

  
14
        # Deleting model 'ResourceMetadata'
15
        db.delete_table('im_resourcemetadata')
16

  
17
        # Removing M2M table for field meta on 'Resource'
18
        db.delete_table('im_resource_meta')
19

  
20
        # Adding unique constraint on 'Resource', fields ['name']
21
        db.create_unique('im_resource', ['name'])
22

  
23

  
24
    def backwards(self, orm):
25
        
26
        # Removing unique constraint on 'Resource', fields ['name']
27
        db.delete_unique('im_resource', ['name'])
28

  
29
        # Adding model 'ResourceMetadata'
30
        db.create_table('im_resourcemetadata', (
31
            ('value', self.gf('django.db.models.fields.CharField')(max_length=255)),
32
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
33
            ('key', self.gf('django.db.models.fields.CharField')(max_length=255, unique=True, db_index=True)),
34
        ))
35
        db.send_create_signal('im', ['ResourceMetadata'])
36

  
37
        # Adding M2M table for field meta on 'Resource'
38
        db.create_table('im_resource_meta', (
39
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
40
            ('resource', models.ForeignKey(orm['im.resource'], null=False)),
41
            ('resourcemetadata', models.ForeignKey(orm['im.resourcemetadata'], null=False))
42
        ))
43
        db.create_unique('im_resource_meta', ['resource_id', 'resourcemetadata_id'])
44

  
45
        # Adding unique constraint on 'Resource', fields ['name', 'service']
46
        db.create_unique('im_resource', ['name', 'service_id'])
47

  
48

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

  
310
    complete_apps = ['im']
b/snf-astakos-app/astakos/im/models.py
142 142
            self.resource_set.create(**s)
143 143

  
144 144

  
145
class ResourceMetadata(models.Model):
146
    key = models.CharField(_('Name'), max_length=255, unique=True, db_index=True)
147
    value = models.CharField(_('Value'), max_length=255)
148

  
149 145
_presentation_data = {}
150 146
def get_presentation(resource):
151 147
    global _presentation_data
......
157 153
    return presentation
158 154

  
159 155
class Resource(models.Model):
160
    name = models.CharField(_('Name'), max_length=255)
161
    meta = models.ManyToManyField(ResourceMetadata)
156
    name = models.CharField(_('Name'), max_length=255, unique=True)
162 157
    service = models.ForeignKey(Service)
163 158
    desc = models.TextField(_('Description'), null=True)
164 159
    unit = models.CharField(_('Name'), null=True, max_length=255)
165 160
    group = models.CharField(_('Group'), null=True, max_length=255)
166 161
    uplimit = intDecimalField(default=0)
167 162

  
168
    class Meta:
169
        unique_together = ("service", "name")
170

  
171 163
    def __str__(self):
172
        return '%s%s%s' % (self.service, RESOURCE_SEPARATOR, self.name)
164
        return self.name
173 165

  
174 166
    def full_name(self):
175 167
        return str(self)

Also available in: Unified diff