Set perks on form save.
[wolnelektury.git] / apps / funding / migrations / 0001_initial.py
1 # -*- coding: 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
8 class Migration(SchemaMigration):
9
10     def forwards(self, orm):
11         # Adding model 'Offer'
12         db.create_table('funding_offer', (
13             ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14             ('author', self.gf('django.db.models.fields.CharField')(max_length=255)),
15             ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
16             ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
17             ('book_url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)),
18             ('redakcja_url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)),
19             ('target', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
20             ('start', self.gf('django.db.models.fields.DateField')()),
21             ('end', self.gf('django.db.models.fields.DateField')()),
22         ))
23         db.send_create_signal('funding', ['Offer'])
24
25         # Adding model 'Perk'
26         db.create_table('funding_perk', (
27             ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
28             ('offer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['funding.Offer'], null=True)),
29             ('price', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
30             ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
31             ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
32         ))
33         db.send_create_signal('funding', ['Perk'])
34
35         # Adding model 'Funding'
36         db.create_table('funding_funding', (
37             ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
38             ('offer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['funding.Offer'])),
39             ('name', self.gf('django.db.models.fields.CharField')(max_length=127)),
40             ('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
41             ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
42             ('payed_at', self.gf('django.db.models.fields.DateTimeField')()),
43         ))
44         db.send_create_signal('funding', ['Funding'])
45
46         # Adding M2M table for field perks on 'Funding'
47         db.create_table('funding_funding_perks', (
48             ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
49             ('funding', models.ForeignKey(orm['funding.funding'], null=False)),
50             ('perk', models.ForeignKey(orm['funding.perk'], null=False))
51         ))
52         db.create_unique('funding_funding_perks', ['funding_id', 'perk_id'])
53
54
55     def backwards(self, orm):
56         # Deleting model 'Offer'
57         db.delete_table('funding_offer')
58
59         # Deleting model 'Perk'
60         db.delete_table('funding_perk')
61
62         # Deleting model 'Funding'
63         db.delete_table('funding_funding')
64
65         # Removing M2M table for field perks on 'Funding'
66         db.delete_table('funding_funding_perks')
67
68
69     models = {
70         'funding.funding': {
71             'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
72             'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
73             'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
74             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
75             'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
76             'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']"}),
77             'payed_at': ('django.db.models.fields.DateTimeField', [], {}),
78             'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['funding.Perk']", 'symmetrical': 'False'})
79         },
80         'funding.offer': {
81             'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
82             'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
83             'book_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
84             'end': ('django.db.models.fields.DateField', [], {}),
85             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
86             'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
87             'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
88             'start': ('django.db.models.fields.DateField', [], {}),
89             'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
90             'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
91         },
92         'funding.perk': {
93             'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
94             'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
95             'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
96             'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
97             'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']", 'null': 'True'}),
98             'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
99         }
100     }
101
102     complete_apps = ['funding']