File: 0001_initial.py

package info (click to toggle)
django-polymorphic 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 892 kB
  • sloc: python: 6,784; javascript: 263; makefile: 137
file content (150 lines) | stat: -rw-r--r-- 5,200 bytes parent folder | download | duplicates (3)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [("contenttypes", "0002_remove_content_type_name")]

    operations = [
        migrations.CreateModel(
            name="Order",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("title", models.CharField(max_length=200, verbose_name="Title")),
            ],
            options={
                "ordering": ("title",),
                "verbose_name": "Organisation",
                "verbose_name_plural": "Organisations",
            },
        ),
        migrations.CreateModel(
            name="Payment",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("currency", models.CharField(default=b"USD", max_length=3)),
                ("amount", models.DecimalField(max_digits=10, decimal_places=2)),
            ],
            options={"verbose_name": "Payment", "verbose_name_plural": "Payments"},
        ),
        migrations.CreateModel(
            name="BankPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        parent_link=True,
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        on_delete=models.CASCADE,
                        to="orders.Payment",
                    ),
                ),
                ("bank_name", models.CharField(max_length=100)),
                ("swift", models.CharField(max_length=20)),
            ],
            options={
                "verbose_name": "Bank Payment",
                "verbose_name_plural": "Bank Payments",
            },
            bases=("orders.payment",),
        ),
        migrations.CreateModel(
            name="CreditCardPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        parent_link=True,
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        on_delete=models.CASCADE,
                        to="orders.Payment",
                    ),
                ),
                ("card_type", models.CharField(max_length=10)),
                (
                    "expiry_month",
                    models.PositiveSmallIntegerField(
                        choices=[
                            (1, "jan"),
                            (2, "feb"),
                            (3, "mar"),
                            (4, "apr"),
                            (5, "may"),
                            (6, "jun"),
                            (7, "jul"),
                            (8, "aug"),
                            (9, "sep"),
                            (10, "oct"),
                            (11, "nov"),
                            (12, "dec"),
                        ]
                    ),
                ),
                ("expiry_year", models.PositiveIntegerField()),
            ],
            options={
                "verbose_name": "Credit Card Payment",
                "verbose_name_plural": "Credit Card Payments",
            },
            bases=("orders.payment",),
        ),
        migrations.CreateModel(
            name="SepaPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        parent_link=True,
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        on_delete=models.CASCADE,
                        to="orders.Payment",
                    ),
                ),
                ("iban", models.CharField(max_length=34)),
                ("bic", models.CharField(max_length=11)),
            ],
            options={
                "verbose_name": "Bank Payment",
                "verbose_name_plural": "Bank Payments",
            },
            bases=("orders.payment",),
        ),
        migrations.AddField(
            model_name="payment",
            name="order",
            field=models.ForeignKey(to="orders.Order", on_delete=models.CASCADE),
        ),
        migrations.AddField(
            model_name="payment",
            name="polymorphic_ctype",
            field=models.ForeignKey(
                related_name="polymorphic_orders.payment_set+",
                editable=False,
                on_delete=models.CASCADE,
                to="contenttypes.ContentType",
                null=True,
            ),
        ),
    ]