-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path0018_application.py
More file actions
104 lines (99 loc) · 3.83 KB
/
Copy path0018_application.py
File metadata and controls
104 lines (99 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Generated by Django 4.2.24 on 2026-07-20
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("partner_programs", "0017_alter_partnerprogramproject_options"),
("projects", "0033_delete_projectnews"),
]
operations = [
migrations.CreateModel(
name="Application",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"status",
models.CharField(
choices=[
("draft", "Draft"),
("submitted", "Submitted"),
("approved", "Approved"),
("rejected", "Rejected"),
("withdrawn", "Withdrawn"),
("cancelled", "Cancelled"),
],
default="draft",
max_length=16,
),
),
("form_data", models.JSONField(blank=True, default=dict)),
("submitted_at", models.DateTimeField(blank=True, null=True)),
("approved_at", models.DateTimeField(blank=True, null=True)),
("rejected_at", models.DateTimeField(blank=True, null=True)),
("withdrawn_at", models.DateTimeField(blank=True, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"created_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="created_program_applications",
to=settings.AUTH_USER_MODEL,
),
),
(
"program",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="applications",
to="partner_programs.partnerprogram",
),
),
(
"project",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="applications",
to="projects.project",
),
),
(
"user",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="program_applications",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name": "Application",
"verbose_name_plural": "Applications",
},
),
migrations.AddConstraint(
model_name="application",
constraint=models.UniqueConstraint(
condition=models.Q(
("status__in", ("draft", "submitted", "approved")),
("user__isnull", False),
),
fields=("user", "program"),
name="uniq_active_application_user_program",
),
),
]