1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
from __future__ import unicode_literals |
3
|
|
|
import datetime |
4
|
|
|
from south.db import db |
5
|
|
|
from south.v2 import DataMigration |
6
|
|
|
from django.db import models |
7
|
|
|
|
8
|
|
|
class Migration(DataMigration): |
9
|
|
|
|
10
|
|
|
def forwards(self, orm): |
11
|
|
|
for profile in orm.RegistrationProfile.objects.all(): |
12
|
|
|
# all registration profile was set status 'untreated' by default |
13
|
|
|
profile.activation_key = None |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
def backwards(self, orm): |
17
|
|
|
for profile in orm.RegistrationProfile.objects.all(): |
18
|
|
|
# profile which is haven't treated yet should set activation_key |
19
|
|
|
# and should send activation key as well |
20
|
|
|
# Note: |
21
|
|
|
# all 'rejeted' profile is expired previously thus doesn't matter |
22
|
|
|
if profile._status == 'untreated': |
23
|
|
|
orm.RegistrationProfile.objects.accept_registration(profile) |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
models = { |
27
|
|
|
'auth.group': { |
28
|
|
|
'Meta': {'object_name': 'Group'}, |
29
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
30
|
|
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), |
31
|
|
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) |
32
|
|
|
}, |
33
|
|
|
'auth.permission': { |
34
|
|
|
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, |
35
|
|
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
36
|
|
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), |
37
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
38
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
39
|
|
|
}, |
40
|
|
|
'auth.user': { |
41
|
|
|
'Meta': {'object_name': 'User'}, |
42
|
|
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), |
43
|
|
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), |
44
|
|
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), |
45
|
|
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), |
46
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
47
|
|
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), |
48
|
|
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), |
49
|
|
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), |
50
|
|
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), |
51
|
|
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), |
52
|
|
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), |
53
|
|
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), |
54
|
|
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) |
55
|
|
|
}, |
56
|
|
|
'contenttypes.contenttype': { |
57
|
|
|
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, |
58
|
|
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
59
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
60
|
|
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
61
|
|
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) |
62
|
|
|
}, |
63
|
|
|
'registration.registrationprofile': { |
64
|
|
|
'Meta': {'object_name': 'RegistrationProfile'}, |
65
|
|
|
'_status': ('django.db.models.fields.CharField', [], {'default': "'untreated'", 'max_length': '10', 'db_column': "'status'"}), |
66
|
|
|
'activation_key': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '40', 'null': 'True'}), |
67
|
|
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
68
|
|
|
'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'registration_profile'", 'unique': 'True', 'to': "orm['auth.User']"}) |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
complete_apps = ['registration'] |
73
|
|
|
|