|
1 | | -# -*- coding: utf-8 -*- |
| 1 | +# encoding: utf-8 |
2 | 2 | from __future__ import unicode_literals |
| 3 | +import datetime |
| 4 | +from south.db import db |
| 5 | +from south.v2 import SchemaMigration |
| 6 | +from django.db import models |
| 7 | +from tastypie.compat import AUTH_USER_MODEL |
3 | 8 |
|
4 | | -from django.db import models, migrations |
5 | | -from django.conf import settings |
6 | | -import tastypie.utils.timezone |
7 | | - |
8 | | - |
9 | | -class Migration(migrations.Migration): |
10 | | - |
11 | | - dependencies = [ |
12 | | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
13 | | - ] |
14 | | - |
15 | | - operations = [ |
16 | | - migrations.CreateModel( |
17 | | - name='ApiAccess', |
18 | | - fields=[ |
19 | | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
20 | | - ('identifier', models.CharField(max_length=255)), |
21 | | - ('url', models.CharField(default='', max_length=255, blank=True)), |
22 | | - ('request_method', models.CharField(default='', max_length=10, blank=True)), |
23 | | - ('accessed', models.PositiveIntegerField()), |
24 | | - ], |
25 | | - options={ |
26 | | - }, |
27 | | - bases=(models.Model,), |
28 | | - ), |
29 | | - migrations.CreateModel( |
30 | | - name='ApiKey', |
31 | | - fields=[ |
32 | | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
33 | | - ('key', models.CharField(default='', max_length=128, db_index=True, blank=True)), |
34 | | - ('created', models.DateTimeField(default=tastypie.utils.timezone.now)), |
35 | | - ('user', models.OneToOneField(related_name='api_key', to=settings.AUTH_USER_MODEL)), |
36 | | - ], |
37 | | - options={ |
38 | | - 'abstract': False, |
39 | | - }, |
40 | | - bases=(models.Model,), |
41 | | - ), |
42 | | - ] |
| 9 | + |
| 10 | +class Migration(SchemaMigration): |
| 11 | + |
| 12 | + def forwards(self, orm): |
| 13 | + |
| 14 | + # Adding model 'ApiAccess' |
| 15 | + db.create_table('tastypie_apiaccess', ( |
| 16 | + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), |
| 17 | + ('identifier', self.gf('django.db.models.fields.CharField')(max_length=255)), |
| 18 | + ('url', self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True)), |
| 19 | + ('request_method', self.gf('django.db.models.fields.CharField')(default='', max_length=10, blank=True)), |
| 20 | + ('accessed', self.gf('django.db.models.fields.PositiveIntegerField')()), |
| 21 | + )) |
| 22 | + db.send_create_signal('tastypie', ['ApiAccess']) |
| 23 | + |
| 24 | + # Adding model 'ApiKey' |
| 25 | + db.create_table('tastypie_apikey', ( |
| 26 | + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), |
| 27 | + ('user', self.gf('django.db.models.fields.related.OneToOneField')(related_name='api_key', unique=True, to=orm[AUTH_USER_MODEL])), |
| 28 | + ('key', self.gf('django.db.models.fields.CharField')(default='', max_length=256, blank=True)), |
| 29 | + ('created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), |
| 30 | + )) |
| 31 | + db.send_create_signal('tastypie', ['ApiKey']) |
| 32 | + |
| 33 | + |
| 34 | + def backwards(self, orm): |
| 35 | + |
| 36 | + # Deleting model 'ApiAccess' |
| 37 | + db.delete_table('tastypie_apiaccess') |
| 38 | + |
| 39 | + # Deleting model 'ApiKey' |
| 40 | + db.delete_table('tastypie_apikey') |
| 41 | + |
| 42 | + |
| 43 | + models = { |
| 44 | + 'auth.group': { |
| 45 | + 'Meta': {'object_name': 'Group'}, |
| 46 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 47 | + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), |
| 48 | + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) |
| 49 | + }, |
| 50 | + 'auth.permission': { |
| 51 | + 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, |
| 52 | + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
| 53 | + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), |
| 54 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 55 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) |
| 56 | + }, |
| 57 | + AUTH_USER_MODEL: { |
| 58 | + 'Meta': {'object_name': AUTH_USER_MODEL.split('.')[-1]}, |
| 59 | + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), |
| 60 | + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), |
| 61 | + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), |
| 62 | + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), |
| 63 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 64 | + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), |
| 65 | + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), |
| 66 | + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), |
| 67 | + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), |
| 68 | + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), |
| 69 | + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), |
| 70 | + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), |
| 71 | + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) |
| 72 | + }, |
| 73 | + 'contenttypes.contenttype': { |
| 74 | + 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, |
| 75 | + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
| 76 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 77 | + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), |
| 78 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) |
| 79 | + }, |
| 80 | + 'tastypie.apiaccess': { |
| 81 | + 'Meta': {'object_name': 'ApiAccess'}, |
| 82 | + 'accessed': ('django.db.models.fields.PositiveIntegerField', [], {}), |
| 83 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 84 | + 'identifier': ('django.db.models.fields.CharField', [], {'max_length': '255'}), |
| 85 | + 'request_method': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), |
| 86 | + 'url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}) |
| 87 | + }, |
| 88 | + 'tastypie.apikey': { |
| 89 | + 'Meta': {'object_name': 'ApiKey'}, |
| 90 | + 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), |
| 91 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
| 92 | + 'key': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), |
| 93 | + 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'api_key'", 'unique': 'True', 'to': "orm['%s']" % AUTH_USER_MODEL}) |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + complete_apps = ['tastypie'] |
0 commit comments