Debian Codegraph @

example/orders/migrations/0001_initial.py

raw
1 from django.db import migrations, models
2
3
4 class Migration(migrations.Migration):
5
6 dependencies = [("contenttypes", "0002_remove_content_type_name")]
7
8 operations = [
9 migrations.CreateModel(
10 name="Order",
11 fields=[
12 (
13 "id",
14 models.AutoField(
15 verbose_name="ID",
16 serialize=False,
17 auto_created=True,
18 primary_key=True,
19 ),
20 ),
21 ("title", models.CharField(max_length=200, verbose_name="Title")),
22 ],
23 options={
24 "ordering": ("title",),
25 "verbose_name": "Organisation",
26 "verbose_name_plural": "Organisations",
27 },
28 ),
29 migrations.CreateModel(
30 name="Payment",
31 fields=[
32 (
33 "id",
34 models.AutoField(
35 verbose_name="ID",
36 serialize=False,
37 auto_created=True,
38 primary_key=True,
39 ),
40 ),
41 ("currency", models.CharField(default=b"USD", max_length=3)),
42 ("amount", models.DecimalField(max_digits=10, decimal_places=2)),
43 ],
44 options={"verbose_name": "Payment", "verbose_name_plural": "Payments"},
45 ),
46 migrations.CreateModel(
47 name="BankPayment",
48 fields=[
49 (
50 "payment_ptr",
51 models.OneToOneField(
52 parent_link=True,
53 auto_created=True,
54 primary_key=True,
55 serialize=False,
56 on_delete=models.CASCADE,
57 to="orders.Payment",
58 ),
59 ),
60 ("bank_name", models.CharField(max_length=100)),
61 ("swift", models.CharField(max_length=20)),
62 ],
63 options={
64 "verbose_name": "Bank Payment",
65 "verbose_name_plural": "Bank Payments",
66 },
67 bases=("orders.payment",),
68 ),
69 migrations.CreateModel(
70 name="CreditCardPayment",
71 fields=[
72 (
73 "payment_ptr",
74 models.OneToOneField(
75 parent_link=True,
76 auto_created=True,
77 primary_key=True,
78 serialize=False,
79 on_delete=models.CASCADE,
80 to="orders.Payment",
81 ),
82 ),
83 ("card_type", models.CharField(max_length=10)),
84 (
85 "expiry_month",
86 models.PositiveSmallIntegerField(
87 choices=[
88 (1, "jan"),
89 (2, "feb"),
90 (3, "mar"),
91 (4, "apr"),
92 (5, "may"),
93 (6, "jun"),
94 (7, "jul"),
95 (8, "aug"),
96 (9, "sep"),
97 (10, "oct"),
98 (11, "nov"),
99 (12, "dec"),
100 ]
101 ),
102 ),
103 ("expiry_year", models.PositiveIntegerField()),
104 ],
105 options={
106 "verbose_name": "Credit Card Payment",
107 "verbose_name_plural": "Credit Card Payments",
108 },
109 bases=("orders.payment",),
110 ),
111 migrations.CreateModel(
112 name="SepaPayment",
113 fields=[
114 (
115 "payment_ptr",
116 models.OneToOneField(
117 parent_link=True,
118 auto_created=True,
119 primary_key=True,
120 serialize=False,
121 on_delete=models.CASCADE,
122 to="orders.Payment",
123 ),
124 ),
125 ("iban", models.CharField(max_length=34)),
126 ("bic", models.CharField(max_length=11)),
127 ],
128 options={
129 "verbose_name": "Bank Payment",
130 "verbose_name_plural": "Bank Payments",
131 },
132 bases=("orders.payment",),
133 ),
134 migrations.AddField(
135 model_name="payment",
136 name="order",
137 field=models.ForeignKey(to="orders.Order", on_delete=models.CASCADE),
138 ),
139 migrations.AddField(
140 model_name="payment",
141 name="polymorphic_ctype",
142 field=models.ForeignKey(
143 related_name="polymorphic_orders.payment_set+",
144 editable=False,
145 on_delete=models.CASCADE,
146 to="contenttypes.ContentType",
147 null=True,
148 ),
149 ),
150 ]