Merge branch 'main' of https://gitea.staxriver.com/staxriver/padelclub_backend
commit
a7d1407a2f
@ -1,5 +1,9 @@ |
|||||||
from django import forms |
from django import forms |
||||||
|
from .models import Coupon |
||||||
|
|
||||||
class GuestCheckoutForm(forms.Form): |
class GuestCheckoutForm(forms.Form): |
||||||
email = forms.EmailField(required=True) |
email = forms.EmailField(required=True) |
||||||
phone = forms.CharField(max_length=20, required=True, label="Téléphone portable") |
phone = forms.CharField(max_length=20, required=True, label="Téléphone portable") |
||||||
|
|
||||||
|
class CouponApplyForm(forms.Form): |
||||||
|
code = forms.CharField(max_length=50) |
||||||
|
|||||||
@ -0,0 +1,54 @@ |
|||||||
|
# Generated by Django 5.1 on 2025-03-27 14:34 |
||||||
|
|
||||||
|
import django.db.models.deletion |
||||||
|
from django.conf import settings |
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('shop', '0023_alter_color_options_color_ordering'), |
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.CreateModel( |
||||||
|
name='Coupon', |
||||||
|
fields=[ |
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||||
|
('code', models.CharField(max_length=50, unique=True)), |
||||||
|
('description', models.CharField(blank=True, max_length=255)), |
||||||
|
('discount_amount', models.DecimalField(decimal_places=2, default=0, max_digits=10)), |
||||||
|
('discount_percent', models.DecimalField(decimal_places=2, default=0, max_digits=5)), |
||||||
|
('is_active', models.BooleanField(default=True)), |
||||||
|
('valid_from', models.DateTimeField()), |
||||||
|
('valid_to', models.DateTimeField()), |
||||||
|
('max_uses', models.IntegerField(default=0)), |
||||||
|
('current_uses', models.IntegerField(default=0)), |
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)), |
||||||
|
('stripe_coupon_id', models.CharField(blank=True, max_length=100, null=True)), |
||||||
|
], |
||||||
|
), |
||||||
|
migrations.AddField( |
||||||
|
model_name='order', |
||||||
|
name='discount_amount', |
||||||
|
field=models.DecimalField(decimal_places=2, default=0.0, max_digits=10), |
||||||
|
), |
||||||
|
migrations.AddField( |
||||||
|
model_name='order', |
||||||
|
name='coupon', |
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='shop.coupon'), |
||||||
|
), |
||||||
|
migrations.CreateModel( |
||||||
|
name='CouponUsage', |
||||||
|
fields=[ |
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||||
|
('guest_email', models.EmailField(blank=True, max_length=254, null=True)), |
||||||
|
('used_at', models.DateTimeField(auto_now_add=True)), |
||||||
|
('coupon', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='usages', to='shop.coupon')), |
||||||
|
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupon_usages', to='shop.order')), |
||||||
|
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), |
||||||
|
], |
||||||
|
), |
||||||
|
] |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
# Generated by Django 5.1 on 2025-03-27 17:34 |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('shop', '0024_coupon_order_discount_amount_order_coupon_and_more'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.AlterField( |
||||||
|
model_name='product', |
||||||
|
name='cut', |
||||||
|
field=models.IntegerField(choices=[(0, 'Unisex'), (1, 'Women'), (2, 'Men'), (3, 'Kids')], default=0), |
||||||
|
), |
||||||
|
] |
||||||
Loading…
Reference in new issue