diff --git a/conservancy/supporters/forms.py b/conservancy/supporters/forms.py index f5dd93ef19b935a2bbf252bb34e6487103462318..8e92368cc52615c5db2465b52ff6e1795414e39e 100644 --- a/conservancy/supporters/forms.py +++ b/conservancy/supporters/forms.py @@ -3,6 +3,8 @@ from django import forms from .models import SustainerOrder class SustainerForm(forms.ModelForm): + amount_monthly = forms.IntegerField(initial=12, required=False) + class Meta: model = SustainerOrder fields = [ @@ -22,4 +24,6 @@ class SustainerForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['amount'].widget.attrs['style'] = 'width: 5rem' + self.fields['amount'].initial = 128 + self.fields['amount_monthly'].widget.attrs['style'] = 'width: 5rem' self.fields['tshirt_size'].widget.attrs['x-model'] = 'tshirt_size' diff --git a/conservancy/supporters/migrations/0002_sustainerorder_monthly_recurring_and_more.py b/conservancy/supporters/migrations/0002_sustainerorder_monthly_recurring_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..b13196a2892681778a3d56f0d514e0881e380ae2 --- /dev/null +++ b/conservancy/supporters/migrations/0002_sustainerorder_monthly_recurring_and_more.py @@ -0,0 +1,71 @@ +# Generated by Django 4.2.16 on 2024-09-18 01:27 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('supporters', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='sustainerorder', + name='monthly_recurring', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='sustainerorder', + name='amount', + field=models.IntegerField( + validators=[django.core.validators.MinValueValidator(100)] + ), + ), + migrations.AlterField( + model_name='sustainerorder', + name='paid_time', + field=models.DateTimeField(blank=True, null=True), + ), + migrations.AlterField( + model_name='sustainerorder', + name='tshirt_size', + field=models.CharField( + choices=[ + ('', (('None', 'None'),)), + ( + "Men's", + ( + ("Men's S", "Men's S"), + ("Men's M", "Men's M"), + ("Men's L", "Men's L"), + ("Men's XL", "Men's XL"), + ("Men's 2XL", "Men's 2XL"), + ), + ), + ( + "Standard women's", + ( + ("Standard women's S", "Standard women's S"), + ("Standard women's M", "Standard women's M"), + ("Standard women's L", "Standard women's L"), + ("Standard women's XL", "Standard women's XL"), + ("Standard women's 2XL", "Standard women's 2XL"), + ), + ), + ( + "Fitted women's", + ( + ("Fitted women's S", "Fitted women's S"), + ("Fitted women's M", "Fitted women's M"), + ("Fitted women's L", "Fitted women's L"), + ("Fitted women's XL", "Fitted women's XL"), + ("Fitted women's 2XL", "Fitted women's 2XL"), + ), + ), + ], + max_length=50, + ), + ), + ] diff --git a/conservancy/supporters/models.py b/conservancy/supporters/models.py index 1aa9c54dfeb533d5fa9d6dbfa4ad1130e9d6f6b0..5d306313c2f81fc45c9598e13ce5fe9bd9e50aea 100644 --- a/conservancy/supporters/models.py +++ b/conservancy/supporters/models.py @@ -60,10 +60,10 @@ class SustainerOrder(models.Model): name = models.CharField(max_length=255) email = models.EmailField() amount = models.IntegerField( - default=128, validators=[ validators.MinValueValidator(100), ]) + monthly_recurring = models.BooleanField(default=False) paid_time = models.DateTimeField(null=True, blank=True) acknowledge_publicly = models.BooleanField(default=False) add_to_mailing_list = models.BooleanField(default=False) diff --git a/conservancy/supporters/templates/supporters/sustainers_stripe.html b/conservancy/supporters/templates/supporters/sustainers_stripe.html index 8715e1ced7b896d7b41d8f2c0c3c0381c9ac2198..37456eb469baf65ec08e447f93a5562aa8903901 100644 --- a/conservancy/supporters/templates/supporters/sustainers_stripe.html +++ b/conservancy/supporters/templates/supporters/sustainers_stripe.html @@ -27,6 +27,9 @@ progress::-webkit-progress-value { background: #224c57; } + .btn:active { + transform: scale(1.05); + } {% endblock %} @@ -275,7 +278,7 @@ reach for reproducibility.

- +
diff --git a/conservancy/supporters/templates/supporters/sustainers_stripe2.html b/conservancy/supporters/templates/supporters/sustainers_stripe2.html index 6a2dd06b6da4143a55267a0e0a3c7d4f18efed24..e741a25bc806983afdb797954d2b6c0e35edee06 100644 --- a/conservancy/supporters/templates/supporters/sustainers_stripe2.html +++ b/conservancy/supporters/templates/supporters/sustainers_stripe2.html @@ -6,6 +6,11 @@ {% block head %} {{ block.super }} + {% endblock %} {% block content %} @@ -17,8 +22,10 @@ x-data="{ tshirt_size: 'None', tshirt_required: function () { return this.tshirt_size !== 'None' }, + recurring: 'once', }"> {% csrf_token %} + {{ form.errors }}
@@ -27,9 +34,16 @@

To send your receipt

-