~speakman/ppvalbok/trunk

« back to all changes in this revision

Viewing changes to swevote/migrations/0002_add_votinglocal.py

  • Committer: Daniel Nyström
  • Date: 2009-05-24 21:35:17 UTC
  • Revision ID: daniel@nystrom.st-20090524213517-q6d1t2d235k5wugu
MAJOR VotingLocal refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
from south.db import db
 
4
from django.db import models
 
5
from swevote.models import *
 
6
 
 
7
class Migration:
 
8
    
 
9
    def forwards(self, orm):
 
10
        
 
11
        # Adding model 'VotingLocal'
 
12
        db.create_table('swevote_votinglocal', (
 
13
            ('id', models.AutoField(primary_key=True)),
 
14
            ('localtype', models.IntegerField()),
 
15
            ('municipality', models.ForeignKey(orm.Municipality)),
 
16
            ('region', models.ForeignKey(orm.Region)),
 
17
            ('name', models.CharField(max_length=60)),
 
18
            ('slug', models.CharField(max_length=80)),
 
19
            ('address1', models.CharField(max_length=60)),
 
20
            ('address2', models.CharField(max_length=60)),
 
21
            ('address3', models.CharField(max_length=60)),
 
22
            ('city', models.CharField(max_length=60)),
 
23
            ('voters', models.IntegerField(default=0)),
 
24
            ('lat', models.DecimalField(max_digits=8, decimal_places=5)),
 
25
            ('lon', models.DecimalField(max_digits=8, decimal_places=5)),
 
26
        ))
 
27
        db.send_create_signal('swevote', ['VotingLocal'])
 
28
        
 
29
        # Adding model 'OpeningHours'
 
30
        db.create_table('swevote_openinghours', (
 
31
            ('id', models.AutoField(primary_key=True)),
 
32
            ('date', models.DateField()),
 
33
            ('opens', models.TimeField()),
 
34
            ('closes', models.TimeField()),
 
35
        ))
 
36
        db.send_create_signal('swevote', ['OpeningHours'])
 
37
        
 
38
        # Adding ManyToManyField 'VotingLocal.opening_hours'
 
39
        db.create_table('swevote_votinglocal_opening_hours', (
 
40
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
 
41
            ('votinglocal', models.ForeignKey(orm.VotingLocal, null=False)),
 
42
            ('openinghours', models.ForeignKey(orm.OpeningHours, null=False))
 
43
        ))
 
44
        
 
45
        # Adding field 'VotingStation.votinglocal'
 
46
        db.add_column('swevote_votingstation', 'votinglocal', models.ForeignKey(orm.VotingLocal, related_name='districts', null=True))
 
47
        
 
48
        # Creating unique_together for [municipality, slug] on VotingLocal.
 
49
        db.create_unique('swevote_votinglocal', ['municipality_id', 'slug'])
 
50
        
 
51
        
 
52
    
 
53
    def backwards(self, orm):
 
54
        
 
55
        # Deleting model 'VotingLocal'
 
56
        db.delete_table('swevote_votinglocal')
 
57
        
 
58
        # Deleting model 'OpeningHours'
 
59
        db.delete_table('swevote_openinghours')
 
60
        
 
61
        # Dropping ManyToManyField 'VotingLocal.opening_hours'
 
62
        db.delete_table('swevote_votinglocal_opening_hours')
 
63
        
 
64
        # Deleting field 'VotingStation.votinglocal'
 
65
        db.delete_column('swevote_votingstation', 'votinglocal_id')
 
66
        
 
67
        # Deleting unique_together for [municipality, slug] on VotingLocal.
 
68
        db.delete_unique('swevote_votinglocal', ['municipality_id', 'slug'])
 
69
        
 
70
    
 
71
    
 
72
    models = {
 
73
        'swevote.openinghours': {
 
74
            'closes': ('models.TimeField', [], {}),
 
75
            'date': ('models.DateField', [], {}),
 
76
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
77
            'opens': ('models.TimeField', [], {})
 
78
        },
 
79
        'swevote.earlyvotingstation': {
 
80
            'Meta': {'ordering': "['name']"},
 
81
            'address1': ('models.CharField', [], {'max_length': '60'}),
 
82
            'address2': ('models.CharField', [], {'max_length': '60'}),
 
83
            'address3': ('models.CharField', [], {'max_length': '60'}),
 
84
            'available': ('models.CharField', [], {'max_length': '600'}),
 
85
            'city': ('models.CharField', [], {'max_length': '60'}),
 
86
            'code': ('models.IntegerField', [], {}),
 
87
            'county': ('models.ForeignKey', ["orm['swevote.County']"], {}),
 
88
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
89
            'lat': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
90
            'lon': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
91
            'municipality': ('models.ForeignKey', ["orm['swevote.Municipality']"], {}),
 
92
            'name': ('models.CharField', [], {'max_length': '100'}),
 
93
            'opening_hours': ('models.CharField', [], {'max_length': '600'}),
 
94
            'region': ('models.ForeignKey', ["orm['swevote.Region']"], {}),
 
95
            'slug': ('models.CharField', [], {'max_length': '100'}),
 
96
            'status': ('models.CharField', [], {'max_length': '10'})
 
97
        },
 
98
        'swevote.municipality': {
 
99
            'Meta': {'ordering': "['name']"},
 
100
            'county': ('models.ForeignKey', ["orm['swevote.County']"], {}),
 
101
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
102
            'name': ('models.CharField', [], {'max_length': '60'}),
 
103
            'region': ('models.ForeignKey', ["orm['swevote.Region']"], {}),
 
104
            'slug': ('models.CharField', [], {'max_length': '60'})
 
105
        },
 
106
        'swevote.votinglocal': {
 
107
            'Meta': {'unique_together': '("municipality","slug")'},
 
108
            'address1': ('models.CharField', [], {'max_length': '60'}),
 
109
            'address2': ('models.CharField', [], {'max_length': '60'}),
 
110
            'address3': ('models.CharField', [], {'max_length': '60'}),
 
111
            'city': ('models.CharField', [], {'max_length': '60'}),
 
112
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
113
            'lat': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
114
            'localtype': ('models.IntegerField', [], {}),
 
115
            'lon': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
116
            'municipality': ('models.ForeignKey', ["orm['swevote.Municipality']"], {}),
 
117
            'name': ('models.CharField', [], {'max_length': '60'}),
 
118
            'opening_hours': ('models.ManyToManyField', ["orm['swevote.OpeningHours']"], {'null': 'True'}),
 
119
            'region': ('models.ForeignKey', ["orm['swevote.Region']"], {}),
 
120
            'slug': ('models.CharField', [], {'max_length': '80'}),
 
121
            'voters': ('models.IntegerField', [], {'default': '0'})
 
122
        },
 
123
        'swevote.votingstation': {
 
124
            'Meta': {'ordering': "['local']"},
 
125
            'address1': ('models.CharField', [], {'max_length': '60'}),
 
126
            'address2': ('models.CharField', [], {'max_length': '60'}),
 
127
            'address3': ('models.CharField', [], {'max_length': '60'}),
 
128
            'available': ('models.CharField', [], {'max_length': '600'}),
 
129
            'city': ('models.CharField', [], {'max_length': '60'}),
 
130
            'code': ('models.IntegerField', [], {}),
 
131
            'county': ('models.ForeignKey', ["orm['swevote.County']"], {}),
 
132
            'done': ('models.CharField', [], {'max_length': '60'}),
 
133
            'hidden': ('models.BooleanField', [], {'default': 'False'}),
 
134
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
135
            'lat': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
136
            'local': ('models.CharField', [], {'max_length': '60'}),
 
137
            'lon': ('models.DecimalField', [], {'max_digits': '8', 'decimal_places': '5'}),
 
138
            'municipality': ('models.ForeignKey', ["orm['swevote.Municipality']"], {}),
 
139
            'name': ('models.CharField', [], {'max_length': '60'}),
 
140
            'parent': ('models.ForeignKey', ["orm['swevote.VotingStation']"], {'null': 'True'}),
 
141
            'region': ('models.ForeignKey', ["orm['swevote.Region']"], {}),
 
142
            'slug': ('models.CharField', [], {'max_length': '60'}),
 
143
            'status': ('models.CharField', [], {'max_length': '10'}),
 
144
            'voters': ('models.IntegerField', [], {'default': '0'}),
 
145
            'votinglocal': ('models.ForeignKey', ["orm['swevote.VotingLocal']"], {'related_name': "'districts'", 'null': 'True'})
 
146
        },
 
147
        'swevote.zipcode': {
 
148
            'Meta': {'ordering': "['city']"},
 
149
            'city': ('models.CharField', [], {'max_length': '60'}),
 
150
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
151
            'municipality': ('models.ForeignKey', ["orm['swevote.Municipality']"], {}),
 
152
            'zipcode': ('models.CharField', [], {'max_length': '5'})
 
153
        },
 
154
        'swevote.region': {
 
155
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
156
            'name': ('models.CharField', [], {'max_length': '60'}),
 
157
            'parent': ('models.ForeignKey', ["orm['swevote.Region']"], {'null': 'True'}),
 
158
            'shortname': ('models.CharField', [], {'unique': 'True', 'max_length': '20'}),
 
159
            'total_early_stations': ('models.IntegerField', [], {'default': '0'}),
 
160
            'total_stations': ('models.IntegerField', [], {'default': '0'}),
 
161
            'total_voters': ('models.IntegerField', [], {'default': '0'})
 
162
        },
 
163
        'swevote.county': {
 
164
            'Meta': {'ordering': "['name']"},
 
165
            'id': ('models.AutoField', [], {'primary_key': 'True'}),
 
166
            'name': ('models.CharField', [], {'max_length': '60'}),
 
167
            'slug': ('models.CharField', [], {'max_length': '60'})
 
168
        }
 
169
    }
 
170
    
 
171
    complete_apps = ['swevote']