1- # Generated by Django 6.0 on 2026-01-03 12:20
1+ # Generated by Django 6.0.1 on 2026-01-08 17:24
22
33import django .core .validators
44import django .db .models .deletion
@@ -54,27 +54,6 @@ class Migration(migrations.Migration):
5454 ("enabled" , models .BooleanField (default = False )),
5555 ],
5656 ),
57- migrations .CreateModel (
58- name = "DeliverySchedule" ,
59- fields = [
60- (
61- "id" ,
62- models .BigAutoField (
63- auto_created = True ,
64- primary_key = True ,
65- serialize = False ,
66- verbose_name = "ID" ,
67- ),
68- ),
69- (
70- "time" ,
71- models .DateTimeField (
72- db_index = True , default = django .utils .timezone .now
73- ),
74- ),
75- ("is_delivered" , models .BooleanField (db_index = True , default = False )),
76- ],
77- ),
7857 migrations .CreateModel (
7958 name = "ImapConnection" ,
8059 fields = [
@@ -129,7 +108,6 @@ class Migration(migrations.Migration):
129108 ),
130109 ("title" , models .CharField (max_length = 200 )),
131110 ("content" , models .TextField ()),
132- ("is_published" , models .BooleanField (default = False )),
133111 ],
134112 ),
135113 migrations .CreateModel (
@@ -189,7 +167,26 @@ class Migration(migrations.Migration):
189167 validators = [django .core .validators .MaxValueValidator (100 )]
190168 ),
191169 ),
192- ("is_published" , models .BooleanField (default = False )),
170+ (
171+ "selection_strategy" ,
172+ models .CharField (
173+ choices = [
174+ ("all" , "All Questions" ),
175+ ("random" , "Random Questions" ),
176+ ],
177+ max_length = 50 ,
178+ ),
179+ ),
180+ (
181+ "deadline_days" ,
182+ models .IntegerField (
183+ help_text = "Time limit to complete the quiz in days. Minimum is 1 day and maximum is 30 days." ,
184+ validators = [
185+ django .core .validators .MinValueValidator (1 ),
186+ django .core .validators .MaxValueValidator (30 ),
187+ ],
188+ ),
189+ ),
193190 ],
194191 options = {
195192 "verbose_name_plural" : "Quizzes" ,
@@ -220,6 +217,7 @@ class Migration(migrations.Migration):
220217 help_text = "Waiting period in seconds after previous content is sent or submited."
221218 ),
222219 ),
220+ ("is_published" , models .BooleanField (default = False )),
223221 (
224222 "course" ,
225223 models .ForeignKey (
@@ -247,6 +245,58 @@ class Migration(migrations.Migration):
247245 ),
248246 ],
249247 ),
248+ migrations .CreateModel (
249+ name = "ContentDelivery" ,
250+ fields = [
251+ (
252+ "id" ,
253+ models .BigAutoField (
254+ auto_created = True ,
255+ primary_key = True ,
256+ serialize = False ,
257+ verbose_name = "ID" ,
258+ ),
259+ ),
260+ ("hash_value" , models .CharField (blank = True , max_length = 64 , null = True )),
261+ ("valid_until" , models .DateTimeField (blank = True , null = True )),
262+ (
263+ "course_content" ,
264+ models .ForeignKey (
265+ on_delete = django .db .models .deletion .CASCADE ,
266+ to = "django_email_learning.coursecontent" ,
267+ ),
268+ ),
269+ ],
270+ ),
271+ migrations .CreateModel (
272+ name = "DeliverySchedule" ,
273+ fields = [
274+ (
275+ "id" ,
276+ models .BigAutoField (
277+ auto_created = True ,
278+ primary_key = True ,
279+ serialize = False ,
280+ verbose_name = "ID" ,
281+ ),
282+ ),
283+ (
284+ "time" ,
285+ models .DateTimeField (
286+ db_index = True , default = django .utils .timezone .now
287+ ),
288+ ),
289+ ("is_delivered" , models .BooleanField (db_index = True , default = False )),
290+ (
291+ "delivery" ,
292+ models .ForeignKey (
293+ on_delete = django .db .models .deletion .CASCADE ,
294+ related_name = "delivery_schedules" ,
295+ to = "django_email_learning.contentdelivery" ,
296+ ),
297+ ),
298+ ],
299+ ),
250300 migrations .CreateModel (
251301 name = "Enrollment" ,
252302 fields = [
@@ -260,17 +310,36 @@ class Migration(migrations.Migration):
260310 ),
261311 ),
262312 ("enrolled_at" , models .DateTimeField (auto_now_add = True )),
263- ("next_send_timestamp" , models .DateTimeField (blank = True , null = True )),
264313 (
265314 "status" ,
266315 models .CharField (
267316 choices = [
268- ("unverified" , "Unverified" ),
269- ("active" , "Active" ),
270- ("completed" , "Completed" ),
271- ("deactivated" , "Deactivated" ),
317+ (
318+ django_email_learning .models .EnrollmentStatus [
319+ "UNVERIFIED"
320+ ],
321+ "Unverified" ,
322+ ),
323+ (
324+ django_email_learning .models .EnrollmentStatus ["ACTIVE" ],
325+ "Active" ,
326+ ),
327+ (
328+ django_email_learning .models .EnrollmentStatus [
329+ "COMPLETED"
330+ ],
331+ "Completed" ,
332+ ),
333+ (
334+ django_email_learning .models .EnrollmentStatus [
335+ "DEACTIVATED"
336+ ],
337+ "Deactivated" ,
338+ ),
339+ ],
340+ default = django_email_learning .models .EnrollmentStatus [
341+ "UNVERIFIED"
272342 ],
273- default = "unverified" ,
274343 max_length = 50 ,
275344 ),
276345 ),
@@ -279,18 +348,38 @@ class Migration(migrations.Migration):
279348 models .CharField (
280349 blank = True ,
281350 choices = [
282- ("canceled" , "Canceled" ),
283- ("blocked" , "Blocked" ),
284- ("failed" , "Failed" ),
285- ("inactive" , "Inactive" ),
351+ (
352+ django_email_learning .models .DeactivationReason [
353+ "CANCELED"
354+ ],
355+ "Canceled" ,
356+ ),
357+ (
358+ django_email_learning .models .DeactivationReason [
359+ "BLOCKED"
360+ ],
361+ "Blocked" ,
362+ ),
363+ (
364+ django_email_learning .models .DeactivationReason [
365+ "FAILED"
366+ ],
367+ "Failed" ,
368+ ),
369+ (
370+ django_email_learning .models .DeactivationReason [
371+ "INACTIVE"
372+ ],
373+ "Inactive" ,
374+ ),
286375 ],
287376 max_length = 50 ,
288377 null = True ,
289378 ),
290379 ),
291380 (
292381 "activation_code" ,
293- models .CharField (blank = True , max_length = 100 , null = True ),
382+ models .CharField (blank = True , max_length = 6 , null = True ),
294383 ),
295384 (
296385 "course" ,
@@ -308,41 +397,13 @@ class Migration(migrations.Migration):
308397 ),
309398 ],
310399 ),
311- migrations .CreateModel (
312- name = "ContentDelivery" ,
313- fields = [
314- (
315- "id" ,
316- models .BigAutoField (
317- auto_created = True ,
318- primary_key = True ,
319- serialize = False ,
320- verbose_name = "ID" ,
321- ),
322- ),
323- ("hash_value" , models .CharField (blank = True , max_length = 64 , null = True )),
324- (
325- "course_content" ,
326- models .ForeignKey (
327- on_delete = django .db .models .deletion .CASCADE ,
328- to = "django_email_learning.coursecontent" ,
329- ),
330- ),
331- (
332- "delivery_schedules" ,
333- models .ManyToManyField (to = "django_email_learning.deliveryschedule" ),
334- ),
335- (
336- "enrollment" ,
337- models .ForeignKey (
338- on_delete = django .db .models .deletion .CASCADE ,
339- to = "django_email_learning.enrollment" ,
340- ),
341- ),
342- ],
343- options = {
344- "unique_together" : {("enrollment" , "course_content" )},
345- },
400+ migrations .AddField (
401+ model_name = "contentdelivery" ,
402+ name = "enrollment" ,
403+ field = models .ForeignKey (
404+ on_delete = django .db .models .deletion .CASCADE ,
405+ to = "django_email_learning.enrollment" ,
406+ ),
346407 ),
347408 migrations .AddField (
348409 model_name = "course" ,
@@ -468,6 +529,10 @@ class Migration(migrations.Migration):
468529 ),
469530 ],
470531 ),
532+ migrations .AlterUniqueTogether (
533+ name = "contentdelivery" ,
534+ unique_together = {("enrollment" , "course_content" )},
535+ ),
471536 migrations .AddConstraint (
472537 model_name = "enrollment" ,
473538 constraint = models .UniqueConstraint (
0 commit comments