Added DonatorStatus model in order to know if an donator has canceled or not his monthly donation, Now we create a DonatorStatus for the user after receiving his first donation. Added DonatorStatus view. Added donator_status.html in order to allow an user view his donation status , Added action to allow user to cancel his monthly donations. Now the user can logout using navbar. added Donation model to admin.Added command make_donations_charges in order to create stripe current monthly donations from all donators
This commit is contained in:
parent
cb520f6b58
commit
4580a75f89
22 changed files with 611 additions and 232 deletions
|
|
@ -1,7 +1,11 @@
|
|||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
from utils.forms import LoginFormMixin, SignupFormMixin
|
||||
from utils.forms import LoginFormMixin, SignupFormMixin, BillingAddressForm
|
||||
from utils.models import BillingAddress
|
||||
|
||||
from .models import Donation, DonatorStatus
|
||||
|
||||
|
||||
class LoginForm(LoginFormMixin):
|
||||
|
|
@ -10,5 +14,38 @@ class LoginForm(LoginFormMixin):
|
|||
|
||||
|
||||
class SignupForm(SignupFormMixin):
|
||||
confirm_password = forms.CharField(widget=forms.EmailInput())
|
||||
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
|
||||
|
||||
class DonationForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Donation
|
||||
fields = ['donation', 'donator', 'billing_address',
|
||||
'last4', 'cc_brand', 'stripe_charge_id']
|
||||
|
||||
def save(self, commit=True):
|
||||
instance = super(DonationForm, self).save(commit=False)
|
||||
|
||||
if commit:
|
||||
DonatorStatus.create(self.cleaned_data['donator'].user)
|
||||
instance.save()
|
||||
|
||||
return instance
|
||||
|
||||
|
||||
class DonationBillingForm(BillingAddressForm):
|
||||
token = forms.CharField(widget=forms.HiddenInput())
|
||||
donation_amount = forms.FloatField(widget=forms.TextInput(attrs={'placeholder': 'Amount'}))
|
||||
|
||||
class Meta:
|
||||
model = BillingAddress
|
||||
fields = ['donation_amount', 'street_address', 'city', 'postal_code', 'country']
|
||||
labels = {
|
||||
'amount': _('Amount'),
|
||||
'street_address': _('Street Address'),
|
||||
'city': _('City'),
|
||||
'postal_code': _('Postal Code'),
|
||||
'Country': _('Country'),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue