0001_initial.py 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Generated by Django 3.0.3 on 2020-02-28 17:52
  2. from django.conf import settings
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. import django.utils.timezone
  6. import organizations.base
  7. import organizations.fields
  8. class Migration(migrations.Migration):
  9. initial = True
  10. dependencies = [
  11. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  12. ]
  13. operations = [
  14. migrations.CreateModel(
  15. name='Organization',
  16. fields=[
  17. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  18. ('name', models.CharField(help_text='The name of the organization', max_length=200)),
  19. ('is_active', models.BooleanField(default=True)),
  20. ('created', organizations.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
  21. ('modified', organizations.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
  22. ('slug', organizations.fields.SlugField(blank=True, editable=False, help_text='The name in all lowercase, suitable for URL identification', max_length=200, populate_from='name', unique=True)),
  23. ],
  24. options={
  25. 'abstract': False,
  26. },
  27. bases=(organizations.base.UnicodeMixin, models.Model),
  28. ),
  29. migrations.CreateModel(
  30. name='OrganizationUser',
  31. fields=[
  32. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  33. ('created', organizations.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False)),
  34. ('modified', organizations.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False)),
  35. ('role', models.PositiveSmallIntegerField(choices=[(0, 'Member'), (1, 'Admin'), (2, 'Manager'), (3, 'Owner')])),
  36. ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organization_users', to='organizations_ext.Organization')),
  37. ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='organizations_ext_organizationuser', to=settings.AUTH_USER_MODEL)),
  38. ],
  39. options={
  40. 'abstract': False,
  41. },
  42. bases=(organizations.base.UnicodeMixin, models.Model),
  43. ),
  44. migrations.CreateModel(
  45. name='OrganizationOwner',
  46. fields=[
  47. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  48. ('organization', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='owner', to='organizations_ext.Organization')),
  49. ('organization_user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='organizations_ext.OrganizationUser')),
  50. ],
  51. options={
  52. 'abstract': False,
  53. },
  54. bases=(organizations.base.UnicodeMixin, models.Model),
  55. ),
  56. migrations.AddField(
  57. model_name='organization',
  58. name='users',
  59. field=models.ManyToManyField(related_name='organizations_ext_organization', through='organizations_ext.OrganizationUser', to=settings.AUTH_USER_MODEL),
  60. ),
  61. ]