-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0002_promo_promocode.py
More file actions
87 lines (82 loc) · 2.9 KB
/
0002_promo_promocode.py
File metadata and controls
87 lines (82 loc) · 2.9 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
# Generated by Django 5.2b1 on 2025-03-28 16:03
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('business', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Promo',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('description', models.CharField(max_length=300)),
(
'image_url',
models.URLField(blank=True, max_length=350, null=True),
),
('target', models.JSONField(default=dict)),
('max_count', models.IntegerField()),
('active_from', models.DateField(blank=True, null=True)),
('active_until', models.DateField(blank=True, null=True)),
(
'mode',
models.CharField(
choices=[('COMMON', 'Common'), ('UNIQUE', 'Unique')],
max_length=10,
),
),
(
'promo_common',
models.CharField(blank=True, max_length=30, null=True),
),
('active', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
(
'company',
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to='business.company',
),
),
],
),
migrations.CreateModel(
name='PromoCode',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('code', models.CharField(max_length=30)),
('is_used', models.BooleanField(default=False)),
('used_at', models.DateTimeField(blank=True, null=True)),
(
'promo',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='unique_codes',
to='business.promo',
),
),
],
options={
'unique_together': {('promo', 'code')},
},
),
]