0001_initial.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # Generated by Django 3.1 on 2020-08-16 15:56
  2. import api_tokens.models
  3. import bitfield.models
  4. from django.conf import settings
  5. from django.db import migrations, models
  6. import django.db.models.deletion
  7. class Migration(migrations.Migration):
  8. initial = True
  9. dependencies = [
  10. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  11. ]
  12. operations = [
  13. migrations.CreateModel(
  14. name="APIToken",
  15. fields=[
  16. (
  17. "id",
  18. models.AutoField(
  19. auto_created=True,
  20. primary_key=True,
  21. serialize=False,
  22. verbose_name="ID",
  23. ),
  24. ),
  25. (
  26. "token",
  27. models.CharField(
  28. default=api_tokens.models.generate_token,
  29. max_length=40,
  30. unique=True,
  31. ),
  32. ),
  33. ("label", models.CharField(blank=True, max_length=255)),
  34. (
  35. "scopes",
  36. bitfield.models.BitField(
  37. (
  38. "project:read",
  39. "project:write",
  40. "project:admin",
  41. "project:releases",
  42. "team:read",
  43. "team:write",
  44. "team:admin",
  45. "event:read",
  46. "event:write",
  47. "event:admin",
  48. "org:read",
  49. "org:write",
  50. "org:admin",
  51. "member:read",
  52. "member:write",
  53. "member:admin",
  54. ),
  55. default=None,
  56. ),
  57. ),
  58. ("created", models.DateTimeField(auto_now_add=True)),
  59. (
  60. "user",
  61. models.ForeignKey(
  62. on_delete=django.db.models.deletion.CASCADE,
  63. to=settings.AUTH_USER_MODEL,
  64. ),
  65. ),
  66. ],
  67. ),
  68. ]