Revision c3b42b86

b/snf-astakos-app/astakos/quotaholder_app/callpoint.py
47 47
    Holding, Commission, Provision, ProvisionLog)
48 48

  
49 49

  
50
def format_datetime(d):
51
    return d.strftime('%Y-%m-%dT%H:%M:%S.%f')[:24]
52

  
53

  
50 54
def get_quota(holders=None, sources=None, resources=None):
51 55
    holdings = Holding.objects.all()
52 56

  
......
189 193
        'usage_min':           holding.usage_min,
190 194
        'usage_max':           holding.usage_max,
191 195
        'delta_quantity':      provision.quantity,
192
        'issue_datetime':      commission.issue_datetime,
193
        'log_datetime':        log_datetime,
196
        'issue_time':          format_datetime(commission.issue_datetime),
197
        'log_time':            format_datetime(log_datetime),
194 198
        'reason':              reason,
195 199
    }
196 200

  
b/snf-astakos-app/astakos/quotaholder_app/migrations/0005_auto__add_field_commission_issue_datetime.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
        # Adding field 'Commission.issue_datetime'
12
        db.add_column('quotaholder_app_commission', 'issue_datetime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 1, 1, 0, 0, 0)), keep_default=False)
13

  
14

  
15
    def backwards(self, orm):
16
        
17
        # Deleting field 'Commission.issue_datetime'
18
        db.delete_column('quotaholder_app_commission', 'issue_datetime')
19

  
20

  
21
    models = {
22
        'quotaholder_app.commission': {
23
            'Meta': {'object_name': 'Commission'},
24
            'clientkey': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
25
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
26
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
27
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4096'}),
28
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
29
        },
30
        'quotaholder_app.holding': {
31
            'Meta': {'unique_together': "(('holder', 'source', 'resource'),)", 'object_name': 'Holding'},
32
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
33
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
35
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
36
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
37
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'}),
38
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'})
39
        },
40
        'quotaholder_app.provision': {
41
            'Meta': {'object_name': 'Provision'},
42
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
43
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
44
            'quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
45
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
46
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'provisions'", 'to': "orm['quotaholder_app.Commission']"}),
47
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'})
48
        },
49
        'quotaholder_app.provisionlog': {
50
            'Meta': {'object_name': 'ProvisionLog'},
51
            'delta_quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
52
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
53
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
54
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
55
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
56
            'log_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
57
            'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
58
            'reason': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
59
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
60
            'serial': ('django.db.models.fields.BigIntegerField', [], {}),
61
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
62
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
63
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'})
64
        }
65
    }
66

  
67
    complete_apps = ['quotaholder_app']
/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
        # Adding field 'Commission.issue_datetime'
12
        db.add_column('quotaholder_app_commission', 'issue_datetime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 1, 1, 0, 0, 0)), keep_default=False)
13

  
14
        # Adding field 'ProvisionLog.issue_datetime'
15
        db.add_column('quotaholder_app_provisionlog', 'issue_datetime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 1, 1, 0, 0, 0)), keep_default=False)
16

  
17
        # Adding field 'ProvisionLog.log_datetime'
18
        db.add_column('quotaholder_app_provisionlog', 'log_datetime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 1, 1, 0, 0, 0)), keep_default=False)
19

  
20

  
21
    def backwards(self, orm):
22
        
23
        # Deleting field 'Commission.issue_datetime'
24
        db.delete_column('quotaholder_app_commission', 'issue_datetime')
25

  
26
        # Deleting field 'ProvisionLog.issue_datetime'
27
        db.delete_column('quotaholder_app_provisionlog', 'issue_datetime')
28

  
29
        # Deleting field 'ProvisionLog.log_datetime'
30
        db.delete_column('quotaholder_app_provisionlog', 'log_datetime')
31

  
32

  
33
    models = {
34
        'quotaholder_app.commission': {
35
            'Meta': {'object_name': 'Commission'},
36
            'clientkey': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
37
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
38
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
39
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4096'}),
40
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
41
        },
42
        'quotaholder_app.holding': {
43
            'Meta': {'unique_together': "(('holder', 'source', 'resource'),)", 'object_name': 'Holding'},
44
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
45
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
46
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
47
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
48
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
49
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'}),
50
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'})
51
        },
52
        'quotaholder_app.provision': {
53
            'Meta': {'object_name': 'Provision'},
54
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
55
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56
            'quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
57
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
58
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'provisions'", 'to': "orm['quotaholder_app.Commission']"}),
59
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'})
60
        },
61
        'quotaholder_app.provisionlog': {
62
            'Meta': {'object_name': 'ProvisionLog'},
63
            'delta_quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
64
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
65
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
66
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
67
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
68
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
69
            'log_datetime': ('django.db.models.fields.DateTimeField', [], {}),
70
            'log_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
71
            'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
72
            'reason': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
73
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
74
            'serial': ('django.db.models.fields.BigIntegerField', [], {}),
75
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
76
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
77
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'})
78
        }
79
    }
80

  
81
    complete_apps = ['quotaholder_app']
b/snf-astakos-app/astakos/quotaholder_app/migrations/0006_datetime.py
4 4
from south.v2 import DataMigration
5 5
from django.db import models
6 6

  
7

  
8 7
class Migration(DataMigration):
9 8

  
10 9
    def forwards(self, orm):
......
16 15
            commission.issue_datetime = dt
17 16
            commission.save()
18 17

  
19
        plogs = orm.ProvisionLog.objects.all()
20
        for plog in plogs:
21
            issue_dt = parse(plog.issue_time)
22
            plog.issue_datetime = issue_dt
23
            log_dt = parse(plog.log_time)
24
            plog.log_datetime = log_dt
25
            plog.save()
26

  
27 18
    def backwards(self, orm):
28 19
        "Write your backwards methods here."
29 20

  
......
61 52
            'delta_quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
62 53
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
63 54
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
64
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
65 55
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
66 56
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
67
            'log_datetime': ('django.db.models.fields.DateTimeField', [], {}),
68 57
            'log_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
69 58
            'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
70 59
            'reason': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
b/snf-astakos-app/astakos/quotaholder_app/migrations/0007_auto__del_field_commission_issue_time.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 field 'Commission.issue_time'
12
        db.delete_column('quotaholder_app_commission', 'issue_time')
13

  
14

  
15
    def backwards(self, orm):
16
        
17
        # User chose to not deal with backwards NULL issues for 'Commission.issue_time'
18
        raise RuntimeError("Cannot reverse this migration. 'Commission.issue_time' and its values cannot be restored.")
19

  
20

  
21
    models = {
22
        'quotaholder_app.commission': {
23
            'Meta': {'object_name': 'Commission'},
24
            'clientkey': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
25
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
26
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4096'}),
27
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
28
        },
29
        'quotaholder_app.holding': {
30
            'Meta': {'unique_together': "(('holder', 'source', 'resource'),)", 'object_name': 'Holding'},
31
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
32
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
33
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
34
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
35
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
36
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'}),
37
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'})
38
        },
39
        'quotaholder_app.provision': {
40
            'Meta': {'object_name': 'Provision'},
41
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
42
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
43
            'quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
44
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
45
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'provisions'", 'to': "orm['quotaholder_app.Commission']"}),
46
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'})
47
        },
48
        'quotaholder_app.provisionlog': {
49
            'Meta': {'object_name': 'ProvisionLog'},
50
            'delta_quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
51
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
52
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
53
            'issue_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
54
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
55
            'log_time': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
56
            'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
57
            'reason': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
58
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
59
            'serial': ('django.db.models.fields.BigIntegerField', [], {}),
60
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
61
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
62
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'})
63
        }
64
    }
65

  
66
    complete_apps = ['quotaholder_app']
/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 field 'Commission.issue_time'
12
        db.delete_column('quotaholder_app_commission', 'issue_time')
13

  
14
        # Deleting field 'ProvisionLog.log_time'
15
        db.delete_column('quotaholder_app_provisionlog', 'log_time')
16

  
17
        # Deleting field 'ProvisionLog.issue_time'
18
        db.delete_column('quotaholder_app_provisionlog', 'issue_time')
19

  
20

  
21
    def backwards(self, orm):
22
        
23
        # User chose to not deal with backwards NULL issues for 'Commission.issue_time'
24
        raise RuntimeError("Cannot reverse this migration. 'Commission.issue_time' and its values cannot be restored.")
25

  
26
        # User chose to not deal with backwards NULL issues for 'ProvisionLog.log_time'
27
        raise RuntimeError("Cannot reverse this migration. 'ProvisionLog.log_time' and its values cannot be restored.")
28

  
29
        # User chose to not deal with backwards NULL issues for 'ProvisionLog.issue_time'
30
        raise RuntimeError("Cannot reverse this migration. 'ProvisionLog.issue_time' and its values cannot be restored.")
31

  
32

  
33
    models = {
34
        'quotaholder_app.commission': {
35
            'Meta': {'object_name': 'Commission'},
36
            'clientkey': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
37
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
38
            'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '4096'}),
39
            'serial': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
40
        },
41
        'quotaholder_app.holding': {
42
            'Meta': {'unique_together': "(('holder', 'source', 'resource'),)", 'object_name': 'Holding'},
43
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
44
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
45
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
46
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
47
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
48
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'}),
49
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'default': '0', 'max_digits': '38', 'decimal_places': '0'})
50
        },
51
        'quotaholder_app.provision': {
52
            'Meta': {'object_name': 'Provision'},
53
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'db_index': 'True'}),
54
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
55
            'quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
56
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
57
            'serial': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'provisions'", 'to': "orm['quotaholder_app.Commission']"}),
58
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'})
59
        },
60
        'quotaholder_app.provisionlog': {
61
            'Meta': {'object_name': 'ProvisionLog'},
62
            'delta_quantity': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
63
            'holder': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
64
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
65
            'issue_datetime': ('django.db.models.fields.DateTimeField', [], {}),
66
            'limit': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
67
            'log_datetime': ('django.db.models.fields.DateTimeField', [], {}),
68
            'name': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
69
            'reason': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
70
            'resource': ('django.db.models.fields.CharField', [], {'max_length': '4096'}),
71
            'serial': ('django.db.models.fields.BigIntegerField', [], {}),
72
            'source': ('django.db.models.fields.CharField', [], {'max_length': '4096', 'null': 'True'}),
73
            'usage_max': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'}),
74
            'usage_min': ('snf_django.lib.db.fields.IntDecimalField', [], {'max_digits': '38', 'decimal_places': '0'})
75
        }
76
    }
77

  
78
    complete_apps = ['quotaholder_app']
b/snf-astakos-app/astakos/quotaholder_app/models.py
92 92

  
93 93
    serial = BigIntegerField()
94 94
    name = CharField(max_length=4096)
95
    issue_datetime = DateTimeField()
96
    log_datetime = DateTimeField()
95
    issue_time = CharField(max_length=4096)
96
    log_time = CharField(max_length=4096)
97 97
    holder = CharField(max_length=4096)
98 98
    source = CharField(max_length=4096, null=True)
99 99
    resource = CharField(max_length=4096)

Also available in: Unified diff