Updates and fixes.
[wolnelektury.git] / src / api / migrations / 0005_consumer_nonce_resource_token.py
1 # -*- coding: utf-8 -*-
2 # Generated by Django 1.11.20 on 2019-02-28 22:38
3 from __future__ import unicode_literals
4
5 from django.conf import settings
6 from django.db import migrations, models
7 import django.db.models.deletion
8
9
10 class Migration(migrations.Migration):
11
12     dependencies = [
13         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14         ('api', '0004_bookuserdata_last_changed'),
15     ]
16
17     operations = [
18         migrations.CreateModel(
19             name='Consumer',
20             fields=[
21                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22                 ('name', models.CharField(max_length=255)),
23                 ('description', models.TextField()),
24                 ('key', models.CharField(max_length=18)),
25                 ('secret', models.CharField(max_length=32)),
26                 ('status', models.CharField(choices=[('pending', 'Pending approval'), ('accepted', 'Accepted'), ('canceled', 'Canceled')], default='pending', max_length=16)),
27                 ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='consumers', to=settings.AUTH_USER_MODEL)),
28             ],
29         ),
30         migrations.CreateModel(
31             name='Nonce',
32             fields=[
33                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
34                 ('token_key', models.CharField(max_length=18)),
35                 ('consumer_key', models.CharField(max_length=18)),
36                 ('key', models.CharField(max_length=255)),
37             ],
38         ),
39         migrations.CreateModel(
40             name='Token',
41             fields=[
42                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
43                 ('key', models.CharField(max_length=18)),
44                 ('secret', models.CharField(max_length=32)),
45                 ('token_type', models.IntegerField(choices=[(1, 'Request'), (2, 'Access')])),
46                 ('timestamp', models.IntegerField()),
47                 ('is_approved', models.BooleanField(default=False)),
48                 ('consumer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Consumer')),
49                 ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tokens', to=settings.AUTH_USER_MODEL)),
50             ],
51         ),
52     ]