0001_initial.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Generated by Django 4.0.3 on 2022-04-11 10:40
  2. from django.db import migrations, models
  3. class Migration(migrations.Migration):
  4. initial = True
  5. dependencies = [
  6. ('auth', '0012_alter_user_first_name_max_length'),
  7. ]
  8. operations = [
  9. migrations.CreateModel(
  10. name='APIKey',
  11. fields=[
  12. ('id', models.CharField(editable=False, max_length=150, primary_key=True, serialize=False, unique=True)),
  13. ('prefix', models.CharField(editable=False, max_length=8, unique=True)),
  14. ('hashed_key', models.CharField(editable=False, max_length=150)),
  15. ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
  16. ('name', models.CharField(default=None, help_text='A free-form name for the API key. Need not be unique. 50 characters max.', max_length=50)),
  17. ('revoked', models.BooleanField(blank=True, default=False, help_text='If the API key is revoked, clients cannot use it anymore. (This cannot be undone.)')),
  18. ('expiry_date', models.DateTimeField(blank=True, help_text='Once API key expires, clients cannot use it anymore.', null=True, verbose_name='Expires')),
  19. ('permission', models.ManyToManyField(related_name='api_keys', to='auth.permission')),
  20. ],
  21. options={
  22. 'verbose_name': 'API key',
  23. 'verbose_name_plural': 'API keys',
  24. 'ordering': ('-created',),
  25. 'abstract': False,
  26. },
  27. ),
  28. ]