Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0001_initial.py 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import models, migrations
  4. import jsonfield.fields
  5. import post_office.fields
  6. import post_office.validators
  7. import post_office.models
  8. class Migration(migrations.Migration):
  9. dependencies = [
  10. ]
  11. operations = [
  12. migrations.CreateModel(
  13. name='Attachment',
  14. fields=[
  15. ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
  16. ('file', models.FileField(upload_to=post_office.models.get_upload_path)),
  17. ('name', models.CharField(help_text='The original filename', max_length=255)),
  18. ],
  19. options={
  20. },
  21. bases=(models.Model,),
  22. ),
  23. migrations.CreateModel(
  24. name='Email',
  25. fields=[
  26. ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
  27. ('from_email', models.CharField(max_length=254, validators=[post_office.validators.validate_email_with_name])),
  28. ('to', post_office.fields.CommaSeparatedEmailField(blank=True)),
  29. ('cc', post_office.fields.CommaSeparatedEmailField(blank=True)),
  30. ('bcc', post_office.fields.CommaSeparatedEmailField(blank=True)),
  31. ('subject', models.CharField(max_length=255, blank=True)),
  32. ('message', models.TextField(blank=True)),
  33. ('html_message', models.TextField(blank=True)),
  34. ('status', models.PositiveSmallIntegerField(blank=True, null=True, db_index=True, choices=[(0, 'sent'), (1, 'failed'), (2, 'queued')])),
  35. ('priority', models.PositiveSmallIntegerField(blank=True, null=True, choices=[(0, 'low'), (1, 'medium'), (2, 'high'), (3, 'now')])),
  36. ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
  37. ('last_updated', models.DateTimeField(auto_now=True, db_index=True)),
  38. ('scheduled_time', models.DateTimeField(db_index=True, null=True, blank=True)),
  39. ('headers', jsonfield.fields.JSONField(null=True, blank=True)),
  40. ('context', jsonfield.fields.JSONField(null=True, blank=True)),
  41. ],
  42. options={
  43. },
  44. bases=(models.Model,),
  45. ),
  46. migrations.CreateModel(
  47. name='EmailTemplate',
  48. fields=[
  49. ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
  50. ('name', models.CharField(help_text=b"e.g: 'welcome_email'", max_length=255)),
  51. ('description', models.TextField(help_text='Description of this template.', blank=True)),
  52. ('subject', models.CharField(blank=True, max_length=255, validators=[post_office.validators.validate_template_syntax])),
  53. ('content', models.TextField(blank=True, validators=[post_office.validators.validate_template_syntax])),
  54. ('html_content', models.TextField(blank=True, validators=[post_office.validators.validate_template_syntax])),
  55. ('created', models.DateTimeField(auto_now_add=True)),
  56. ('last_updated', models.DateTimeField(auto_now=True)),
  57. ],
  58. options={
  59. },
  60. bases=(models.Model,),
  61. ),
  62. migrations.CreateModel(
  63. name='Log',
  64. fields=[
  65. ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
  66. ('date', models.DateTimeField(auto_now_add=True)),
  67. ('status', models.PositiveSmallIntegerField(choices=[(0, 'sent'), (1, 'failed')])),
  68. ('exception_type', models.CharField(max_length=255, blank=True)),
  69. ('message', models.TextField()),
  70. ('email', models.ForeignKey(related_name='logs', editable=False, on_delete=models.deletion.CASCADE, to='post_office.Email', )),
  71. ],
  72. options={
  73. },
  74. bases=(models.Model,),
  75. ),
  76. migrations.AddField(
  77. model_name='email',
  78. name='template',
  79. field=models.ForeignKey(blank=True, on_delete=models.deletion.SET_NULL, to='post_office.EmailTemplate', null=True),
  80. preserve_default=True,
  81. ),
  82. migrations.AddField(
  83. model_name='attachment',
  84. name='emails',
  85. field=models.ManyToManyField(related_name='attachments', to='post_office.Email'),
  86. preserve_default=True,
  87. ),
  88. ]