Generate submission from latest contact
[edumed.git] / wtem / 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 'Submission'
12         db.create_table(u'wtem_submission', (
13             (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14             ('contact', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contact.Contact'], null=True)),
15             ('key', self.gf('django.db.models.fields.CharField')(unique=True, max_length=30)),
16             ('first_name', self.gf('django.db.models.fields.CharField')(max_length=100)),
17             ('last_name', self.gf('django.db.models.fields.CharField')(max_length=100)),
18             ('email', self.gf('django.db.models.fields.EmailField')(unique=True, max_length=100)),
19             ('answers', self.gf('django.db.models.fields.CharField')(max_length=65536, null=True, blank=True)),
20         ))
21         db.send_create_signal(u'wtem', ['Submission'])
22
23         # Adding model 'Attachment'
24         db.create_table(u'wtem_attachment', (
25             (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
26             ('submission', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['wtem.Submission'])),
27             ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
28             ('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
29         ))
30         db.send_create_signal(u'wtem', ['Attachment'])
31
32
33     def backwards(self, orm):
34         # Deleting model 'Submission'
35         db.delete_table(u'wtem_submission')
36
37         # Deleting model 'Attachment'
38         db.delete_table(u'wtem_attachment')
39
40
41     models = {
42         u'contact.contact': {
43             'Meta': {'ordering': "('-created_at',)", 'object_name': 'Contact'},
44             'body': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
45             'contact': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
46             'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
47             'form_tag': ('django.db.models.fields.CharField', [], {'max_length': '32', 'db_index': 'True'}),
48             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
49             'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15'})
50         },
51         u'wtem.attachment': {
52             'Meta': {'object_name': 'Attachment'},
53             'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
54             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
55             'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
56             'submission': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['wtem.Submission']"})
57         },
58         u'wtem.submission': {
59             'Meta': {'object_name': 'Submission'},
60             'answers': ('django.db.models.fields.CharField', [], {'max_length': '65536', 'null': 'True', 'blank': 'True'}),
61             'contact': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contact.Contact']", 'null': 'True'}),
62             'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '100'}),
63             'first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
64             u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
65             'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),
66             'last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
67         }
68     }
69
70     complete_apps = ['wtem']